From 4fb275ec6e55659f487eca244195a2f2cd7f27df Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Wed, 26 Sep 2018 19:47:06 -0500 Subject: [PATCH] Get more video information when possible --- src/invidious/videos.cr | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index cd423b68..87686a51 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -540,8 +540,13 @@ def fetch_video(id, proxies) proxy = HTTPProxy.new(proxy_host: proxy[:ip], proxy_port: proxy[:port]) client.set_proxy(proxy) + proxy_info = client.get("/get_video_info?video_id=#{id}&el=detailpage&ps=default&eurl=&gl=US&hl=en&disable_polymer=1") + proxy_info = HTTP::Params.parse(proxy_info.body) + + if proxy_info["reason"]? proxy_info = client.get("/get_video_info?video_id=#{id}&ps=default&eurl=&gl=US&hl=en&disable_polymer=1") proxy_info = HTTP::Params.parse(proxy_info.body) + end if !proxy_info["reason"]? proxy_html = client.get("/watch?v=#{id}&bpctr=#{Time.new.epoch + 2000}&gl=US&hl=en&disable_polymer=1")