mirror of
https://github.com/iv-org/invidious.git
synced 2024-10-01 01:25:56 -04:00
Proxy: Handle non-200 HTTP codes on DASH manifests (#4429)
Before this PR, Invidious assumed that fetching the DASH manifest from YouTube will always be successful and didn't check the status code. That meant that if YouTube gave a rate-limiting page, invidious would return an HTTP 200 response with the 'application/dash+xml' Content-Type header and the YouTube ratelimiting page as the body. No associated issue
This commit is contained in:
commit
bcb679e653
@ -21,7 +21,13 @@ module Invidious::Routes::API::Manifest
|
||||
end
|
||||
|
||||
if dashmpd = video.dash_manifest_url
|
||||
manifest = YT_POOL.client &.get(URI.parse(dashmpd).request_target).body
|
||||
response = YT_POOL.client &.get(URI.parse(dashmpd).request_target)
|
||||
|
||||
if response.status_code != 200
|
||||
haltf env, status_code: response.status_code
|
||||
end
|
||||
|
||||
manifest = response.body
|
||||
|
||||
manifest = manifest.gsub(/<BaseURL>[^<]+<\/BaseURL>/) do |baseurl|
|
||||
url = baseurl.lchop("<BaseURL>")
|
||||
|
Loading…
Reference in New Issue
Block a user