diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-09-27 17:11:19 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-09-27 17:11:19 -0500 |
| commit | c2f7d3d41c184af24dff5489849dc92313bed03e (patch) | |
| tree | f842ee945efaef3a4bb1e91a631f0e08f5b9ad57 | |
| parent | b0b5e3e982987cc860369c41950ebbdbc602b6b9 (diff) | |
| download | invidious-c2f7d3d41c184af24dff5489849dc92313bed03e.tar.gz invidious-c2f7d3d41c184af24dff5489849dc92313bed03e.tar.bz2 invidious-c2f7d3d41c184af24dff5489849dc92313bed03e.zip | |
Add handling for specific genre channels
| -rw-r--r-- | src/invidious/videos.cr | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index 87686a51..acaef4c1 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -544,8 +544,8 @@ def fetch_video(id, proxies) 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) + 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"]? @@ -604,10 +604,15 @@ def fetch_video(id, proxies) genre = html.xpath_node(%q(//meta[@itemprop="genre"])).not_nil!["content"] genre_url = html.xpath_node(%(//a[text()="#{genre}"])).try &.["href"] - if genre == "Movies" - genre_url ||= "/channel/UClgRkhTL3_hImCAmdLfDE4g" + case genre + when "Movies" + genre_url = "/channel/UClgRkhTL3_hImCAmdLfDE4g" + when "Education" + # Education channel is linked but does not exist + # genre_url = "/channel/UC3yA8nDwraeOfnYfBWun83g" + genre_url = "" end - genre_url = "" + genre_url ||= "" license = html.xpath_node(%q(//h4[contains(text(),"License")]/parent::*/ul/li)) if license |
