diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-10-21 21:44:20 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-10-21 21:44:20 -0500 |
| commit | ed3d9ce54088e2ffa42ebd47e2e7247d64062e8c (patch) | |
| tree | 31c66bd64c2517bb20b330c990279466aa5ad775 /src | |
| parent | ef95dc2380294d70f0e303b5e2b5bf9c07840769 (diff) | |
| download | invidious-ed3d9ce54088e2ffa42ebd47e2e7247d64062e8c.tar.gz invidious-ed3d9ce54088e2ffa42ebd47e2e7247d64062e8c.tar.bz2 invidious-ed3d9ce54088e2ffa42ebd47e2e7247d64062e8c.zip | |
Make channel extractor more robust
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious/channels.cr | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/invidious/channels.cr b/src/invidious/channels.cr index 4d9d89c8..5647dbc5 100644 --- a/src/invidious/channels.cr +++ b/src/invidious/channels.cr @@ -189,15 +189,15 @@ end def get_about_info(ucid) client = make_client(YT_URL) - about = client.get("/user/#{ucid}/about?disable_polymer=1") + about = client.get("/user/#{ucid}/about?disable_polymer=1&gl=US&hl=en") about = XML.parse_html(about.body) - if !about.xpath_node(%q(//span[@class="qualified-channel-title-text"]/a)) - about = client.get("/channel/#{ucid}/about?disable_polymer=1") + if !about.xpath_node(%q(//span[contains(@class,"qualified-channel-title-text")]/a)) + about = client.get("/channel/#{ucid}/about?disable_polymer=1&gl=US&hl=en") about = XML.parse_html(about.body) end - if !about.xpath_node(%q(//span[@class="qualified-channel-title-text"]/a)) + if !about.xpath_node(%q(//span[contains(@class,"qualified-channel-title-text")]/a)) raise "User does not exist." end @@ -207,7 +207,7 @@ def get_about_info(ucid) end sub_count ||= 0 - author = about.xpath_node(%q(//span[@class="qualified-channel-title-text"]/a)).not_nil!.content + author = about.xpath_node(%q(//span[contains(@class,"qualified-channel-title-text")]/a)).not_nil!.content ucid = about.xpath_node(%q(//link[@rel="canonical"])).not_nil!["href"].split("/")[-1] # Auto-generated channels |
