From aa8ff7ace3602febb4ac4ffb922d18f27628730e Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Thu, 11 Apr 2019 13:52:09 -0500 Subject: [PATCH] Always use ucid for channel search --- src/invidious.cr | 6 +----- src/invidious/search.cr | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index cb0950999..6ecc05597 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -2521,11 +2521,7 @@ get "/channel/:ucid" do |env| end if !auto_generated - if author.includes?(" ") || author.includes?("-") - env.set "search", "channel:#{ucid} " - else - env.set "search", "channel:#{author.downcase} " - end + env.set "search", "channel:#{ucid} " end if auto_generated diff --git a/src/invidious/search.cr b/src/invidious/search.cr index 9c985552d..c3c48af3d 100644 --- a/src/invidious/search.cr +++ b/src/invidious/search.cr @@ -53,12 +53,12 @@ alias SearchItem = SearchVideo | SearchChannel | SearchPlaylist def channel_search(query, page, channel) client = make_client(YT_URL) - response = client.get("/user/#{channel}?disable_polymer=1&hl=en&gl=US") + response = client.get("/channel/#{channel}?disable_polymer=1&hl=en&gl=US") document = XML.parse_html(response.body) canonical = document.xpath_node(%q(//link[@rel="canonical"])) if !canonical - response = client.get("/channel/#{channel}?disable_polymer=1&hl=en&gl=US") + response = client.get("/c/#{channel}?disable_polymer=1&hl=en&gl=US") document = XML.parse_html(response.body) canonical = document.xpath_node(%q(//link[@rel="canonical"])) end