mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-03-16.git
synced 2024-08-15 00:53:18 +00:00
Pull dash URL from player response
This commit is contained in:
parent
6b12449be4
commit
09d0972ab4
2 changed files with 5 additions and 5 deletions
|
@ -3735,8 +3735,8 @@ get "/api/manifest/dash/id/:id" do |env|
|
||||||
halt env, status_code: 403
|
halt env, status_code: 403
|
||||||
end
|
end
|
||||||
|
|
||||||
if video.info["dashmpd"]?
|
if dashmpd = video.player_response["streamingData"]["dashManifestUrl"]?.try &.as_s
|
||||||
manifest = client.get(video.info["dashmpd"]).body
|
manifest = client.get(dashmpd).body
|
||||||
|
|
||||||
manifest = manifest.gsub(/<BaseURL>[^<]+<\/BaseURL>/) do |baseurl|
|
manifest = manifest.gsub(/<BaseURL>[^<]+<\/BaseURL>/) do |baseurl|
|
||||||
url = baseurl.lchop("<BaseURL>")
|
url = baseurl.lchop("<BaseURL>")
|
||||||
|
@ -3993,7 +3993,7 @@ get "/videoplayback" do |env|
|
||||||
end
|
end
|
||||||
|
|
||||||
if response.status_code >= 400
|
if response.status_code >= 400
|
||||||
halt env, status_code: 403
|
halt env, status_code: response.status_code
|
||||||
end
|
end
|
||||||
|
|
||||||
client = make_client(URI.parse(host), proxies, region)
|
client = make_client(URI.parse(host), proxies, region)
|
||||||
|
|
|
@ -300,9 +300,9 @@ class Video
|
||||||
self.info["adaptive_fmts"].split(",") do |string|
|
self.info["adaptive_fmts"].split(",") do |string|
|
||||||
adaptive_fmts << HTTP::Params.parse(string)
|
adaptive_fmts << HTTP::Params.parse(string)
|
||||||
end
|
end
|
||||||
elsif self.info.has_key?("dashmpd")
|
elsif dashmpd = self.player_response["streamingData"]["dashManifestUrl"]?.try &.as_s
|
||||||
client = make_client(YT_URL)
|
client = make_client(YT_URL)
|
||||||
response = client.get(self.info["dashmpd"])
|
response = client.get(dashmpd)
|
||||||
document = XML.parse_html(response.body)
|
document = XML.parse_html(response.body)
|
||||||
|
|
||||||
document.xpath_nodes(%q(//adaptationset)).each do |adaptation_set|
|
document.xpath_nodes(%q(//adaptationset)).each do |adaptation_set|
|
||||||
|
|
Loading…
Reference in a new issue