mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-03-16.git
synced 2024-08-15 00:53:18 +00:00
Add '/api/v1/channels/search'
This commit is contained in:
parent
60038b29f1
commit
f80f4f2521
2 changed files with 103 additions and 8 deletions
|
@ -220,7 +220,7 @@ def extract_items(nodeset, ucid = nil)
|
|||
author = ""
|
||||
author_id = ""
|
||||
else
|
||||
author = anchor.content
|
||||
author = anchor.content.strip
|
||||
author_id = anchor["href"].split("/")[-1]
|
||||
end
|
||||
|
||||
|
@ -234,7 +234,7 @@ def extract_items(nodeset, ucid = nil)
|
|||
description_html = node.xpath_node(%q(.//div[contains(@class, "yt-lockup-description")]))
|
||||
description_html, description = html_to_content(description_html)
|
||||
|
||||
case node.xpath_node(%q(.//div)).not_nil!["class"]
|
||||
case node.xpath_node(%q(.//div[contains(@class, "yt-lockup-tile")])).not_nil!["class"]
|
||||
when .includes? "yt-lockup-playlist"
|
||||
plid = HTTP::Params.parse(URI.parse(id).query.not_nil!)["list"]
|
||||
|
||||
|
@ -245,10 +245,10 @@ def extract_items(nodeset, ucid = nil)
|
|||
video_count ||= 0
|
||||
|
||||
videos = [] of SearchPlaylistVideo
|
||||
node.xpath_nodes(%q(.//ol[contains(@class, "yt-lockup-playlist-items")]/li)).each do |video|
|
||||
node.xpath_nodes(%q(.//*[contains(@class, "yt-lockup-playlist-items")]/li)).each do |video|
|
||||
anchor = video.xpath_node(%q(.//a))
|
||||
if anchor
|
||||
video_title = anchor.content
|
||||
video_title = anchor.content.strip
|
||||
id = HTTP::Params.parse(URI.parse(anchor["href"]).query.not_nil!)["v"]
|
||||
end
|
||||
video_title ||= ""
|
||||
|
@ -276,7 +276,7 @@ def extract_items(nodeset, ucid = nil)
|
|||
videos
|
||||
)
|
||||
when .includes? "yt-lockup-channel"
|
||||
author = title
|
||||
author = title.strip
|
||||
ucid = id.split("/")[-1]
|
||||
|
||||
author_thumbnail = node.xpath_node(%q(.//div/span/img)).try &.["data-thumb"]?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue