Always use ucid for channel search
This commit is contained in:
parent
4e6a931de3
commit
aa8ff7ace3
|
@ -2521,11 +2521,7 @@ get "/channel/:ucid" do |env|
|
||||||
end
|
end
|
||||||
|
|
||||||
if !auto_generated
|
if !auto_generated
|
||||||
if author.includes?(" ") || author.includes?("-")
|
env.set "search", "channel:#{ucid} "
|
||||||
env.set "search", "channel:#{ucid} "
|
|
||||||
else
|
|
||||||
env.set "search", "channel:#{author.downcase} "
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if auto_generated
|
if auto_generated
|
||||||
|
|
|
@ -53,12 +53,12 @@ alias SearchItem = SearchVideo | SearchChannel | SearchPlaylist
|
||||||
def channel_search(query, page, channel)
|
def channel_search(query, page, channel)
|
||||||
client = make_client(YT_URL)
|
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)
|
document = XML.parse_html(response.body)
|
||||||
canonical = document.xpath_node(%q(//link[@rel="canonical"]))
|
canonical = document.xpath_node(%q(//link[@rel="canonical"]))
|
||||||
|
|
||||||
if !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)
|
document = XML.parse_html(response.body)
|
||||||
canonical = document.xpath_node(%q(//link[@rel="canonical"]))
|
canonical = document.xpath_node(%q(//link[@rel="canonical"]))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue