diff options
author | Omar Roth <omarroth@hotmail.com> | 2019-02-25 09:11:41 -0600 |
---|---|---|
committer | Omar Roth <omarroth@hotmail.com> | 2019-02-25 09:11:41 -0600 |
commit | 09d0972ab45227be66e3e3a29934c3378dc6dc1f (patch) | |
tree | d3e74f469eceb0c1ced066ac5a015deb13bcf4fa | |
parent | 6b12449be4a8cf1015fd3ad93b3b90ec93dc0210 (diff) |
Pull dash URL from player response0.14.1
-rw-r--r-- | src/invidious.cr | 6 | ||||
-rw-r--r-- | src/invidious/videos.cr | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 3129f6d2..dda725ff 100644 --- a/src/invidious.cr +++ b/src/invidious.cr | |||
@@ -3735,8 +3735,8 @@ get "/api/manifest/dash/id/:id" do |env| | |||
3735 | halt env, status_code: 403 | 3735 | halt env, status_code: 403 |
3736 | end | 3736 | end |
3737 | 3737 | ||
3738 | if video.info["dashmpd"]? | 3738 | if dashmpd = video.player_response["streamingData"]["dashManifestUrl"]?.try &.as_s |
3739 | manifest = client.get(video.info["dashmpd"]).body | 3739 | manifest = client.get(dashmpd).body |
3740 | 3740 | ||
3741 | manifest = manifest.gsub(/<BaseURL>[^<]+<\/BaseURL>/) do |baseurl| | 3741 | manifest = manifest.gsub(/<BaseURL>[^<]+<\/BaseURL>/) do |baseurl| |
3742 | url = baseurl.lchop("<BaseURL>") | 3742 | url = baseurl.lchop("<BaseURL>") |
@@ -3993,7 +3993,7 @@ get "/videoplayback" do |env| | |||
3993 | end | 3993 | end |
3994 | 3994 | ||
3995 | if response.status_code >= 400 | 3995 | if response.status_code >= 400 |
3996 | halt env, status_code: 403 | 3996 | halt env, status_code: response.status_code |
3997 | end | 3997 | end |
3998 | 3998 | ||
3999 | client = make_client(URI.parse(host), proxies, region) | 3999 | client = make_client(URI.parse(host), proxies, region) |
diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index 03770af7..e02378f7 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr | |||
@@ -300,9 +300,9 @@ class Video | |||
300 | self.info["adaptive_fmts"].split(",") do |string| | 300 | self.info["adaptive_fmts"].split(",") do |string| |
301 | adaptive_fmts << HTTP::Params.parse(string) | 301 | adaptive_fmts << HTTP::Params.parse(string) |
302 | end | 302 | end |
303 | elsif self.info.has_key?("dashmpd") | 303 | elsif dashmpd = self.player_response["streamingData"]["dashManifestUrl"]?.try &.as_s |
304 | client = make_client(YT_URL) | 304 | client = make_client(YT_URL) |
305 | response = client.get(self.info["dashmpd"]) | 305 | response = client.get(dashmpd) |
306 | document = XML.parse_html(response.body) | 306 | document = XML.parse_html(response.body) |
307 | 307 | ||
308 | document.xpath_nodes(%q(//adaptationset)).each do |adaptation_set| | 308 | document.xpath_nodes(%q(//adaptationset)).each do |adaptation_set| |