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/latest/:ucid
This commit is contained in:
parent
58fb74179b
commit
a210327318
2 changed files with 68 additions and 0 deletions
|
@ -460,3 +460,21 @@ def get_60_videos(ucid, page, auto_generated, sort_by = "newest")
|
|||
|
||||
return videos, count
|
||||
end
|
||||
|
||||
def get_latest_videos(ucid)
|
||||
client = make_client(YT_URL)
|
||||
videos = [] of SearchVideo
|
||||
|
||||
url = produce_channel_videos_url(ucid, 0)
|
||||
response = client.get(url)
|
||||
json = JSON.parse(response.body)
|
||||
|
||||
if json["content_html"]? && !json["content_html"].as_s.empty?
|
||||
document = XML.parse_html(json["content_html"].as_s)
|
||||
nodeset = document.xpath_nodes(%q(//li[contains(@class, "feed-item-container")]))
|
||||
|
||||
videos = extract_videos(nodeset, ucid)
|
||||
end
|
||||
|
||||
return videos
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue