summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2019-01-25 11:35:25 -0600
committerOmar Roth <omarroth@hotmail.com>2019-01-25 11:35:25 -0600
commit1f6078cf256d11b8c39608cda53fc6bc2c4bf440 (patch)
tree23cd91580e2e351d803cd7f82fd3e15606125806 /src
parentba36ab95592b69dab0443741fa4dce77057cd00e (diff)
downloadinvidious-1f6078cf256d11b8c39608cda53fc6bc2c4bf440.tar.gz
invidious-1f6078cf256d11b8c39608cda53fc6bc2c4bf440.tar.bz2
invidious-1f6078cf256d11b8c39608cda53fc6bc2c4bf440.zip
Fix links to invalid genre channels
Diffstat (limited to 'src')
-rw-r--r--src/invidious/videos.cr15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr
index 18a2ff8a..ec911e3f 100644
--- a/src/invidious/videos.cr
+++ b/src/invidious/videos.cr
@@ -670,13 +670,20 @@ def fetch_video(id, proxies, region)
genre = html.xpath_node(%q(//meta[@itemprop="genre"])).try &.["content"]
genre ||= ""
- genre_url = html.xpath_node(%(//a[text()="#{genre}"])).try &.["href"]
+ genre_url = html.xpath_node(%(//ul[contains(@class, "watch-info-tag-list")]/li/a[text()="#{genre}"])).try &.["href"]
+
+ # Sometimes YouTube tries to link to invalid/missing channels, so we fix that here
case genre
+ when "Education"
+ genre_url = "/channel/UCdxpofrI-dO6oYfsqHDHphw"
+ when "Gaming"
+ genre_url = "/channel/UCOpNcN46UbXVtpKMrmU4Abg"
when "Movies"
genre_url = "/channel/UClgRkhTL3_hImCAmdLfDE4g"
- when "Education"
- # Education channel is linked but does not exist
- genre_url = "/channel/UC3yA8nDwraeOfnYfBWun83g"
+ when "Nonprofits & Activism"
+ genre_url = "/channel/UCfFyYRYslvuhwMDnx6KjUvw"
+ when "Trailers"
+ genre_url = "/channel/UClgRkhTL3_hImCAmdLfDE4g"
end
genre_url ||= ""