summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2019-02-27 15:15:24 -0600
committerOmar Roth <omarroth@hotmail.com>2019-02-27 15:15:24 -0600
commit0c8dff162d2431e087b28f334827dbe3a65a233e (patch)
tree14f5358f7399256946c7b0c175cee8cf28f7088e
parent4865529fed65ac1a56bd4e36859828fcce314183 (diff)
downloadinvidious-0c8dff162d2431e087b28f334827dbe3a65a233e.tar.gz
invidious-0c8dff162d2431e087b28f334827dbe3a65a233e.tar.bz2
invidious-0c8dff162d2431e087b28f334827dbe3a65a233e.zip
Fix embed extractor for age-gated videos
-rw-r--r--src/invidious/videos.cr5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr
index c6ee7232..1de591b3 100644
--- a/src/invidious/videos.cr
+++ b/src/invidious/videos.cr
@@ -636,7 +636,10 @@ def fetch_video(id, proxies, region)
# Try to pull streams from embed URL
if info["reason"]?
- embed_info = HTTP::Params.parse(client.get("/get_video_info?video_id=#{id}&ps=default&eurl=&gl=US&hl=en&disable_polymer=1").body)
+ embed_page = client.get("/embed/#{id}").body
+ sts = embed_page.match(/"sts"\s*:\s*(?<sts>\d+)/).try &.["sts"]?
+ sts ||= ""
+ embed_info = HTTP::Params.parse(client.get("/get_video_info?video_id=#{id}&eurl=https://youtube.googleapis.com/v/#{id}&gl=US&hl=en&disable_polymer=1&sts=#{sts}").body)
if !embed_info["reason"]?
embed_info.each do |key, value|