summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2019-02-18 16:06:00 -0600
committerOmar Roth <omarroth@hotmail.com>2019-02-18 16:06:00 -0600
commit92223dbee58e4f1eecedfd41cf122a13f8c30489 (patch)
treecf23e93897479a2b1701de6b9a92edf3b725c4ad /src
parent1ceb827a82b4e36496d5ab1a3d73c9f487f93413 (diff)
downloadinvidious-92223dbee58e4f1eecedfd41cf122a13f8c30489.tar.gz
invidious-92223dbee58e4f1eecedfd41cf122a13f8c30489.tar.bz2
invidious-92223dbee58e4f1eecedfd41cf122a13f8c30489.zip
Fix channel RSS feed
Diffstat (limited to 'src')
-rw-r--r--src/invidious.cr36
1 files changed, 33 insertions, 3 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index 8db804df..fa9fcacf 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -1929,9 +1929,39 @@ get "/feed/channel/:ucid" do |env|
halt env, status_code: 500, response: error_message
end
- page = 1
- videos, count = get_60_videos(ucid, page, auto_generated)
- videos.select! { |video| !video.paid }
+ client = make_client(YT_URL)
+ rss = client.get("/feeds/videos.xml?channel_id=#{ucid}").body
+ rss = XML.parse_html(rss)
+
+ videos = [] of SearchVideo
+
+ rss.xpath_nodes("//feed/entry").each do |entry|
+ video_id = entry.xpath_node("videoid").not_nil!.content
+ title = entry.xpath_node("title").not_nil!.content
+
+ published = Time.parse(entry.xpath_node("published").not_nil!.content, "%FT%X%z", Time::Location.local)
+ updated = Time.parse(entry.xpath_node("updated").not_nil!.content, "%FT%X%z", Time::Location.local)
+
+ author = entry.xpath_node("author/name").not_nil!.content
+ ucid = entry.xpath_node("channelid").not_nil!.content
+ description = entry.xpath_node("group/description").not_nil!.content
+ views = entry.xpath_node("group/community/statistics").not_nil!.["views"].to_i64
+
+ videos << SearchVideo.new(
+ title: title,
+ id: video_id,
+ author: author,
+ ucid: ucid,
+ published: published,
+ views: views,
+ description: description,
+ description_html: "",
+ length_seconds: 0,
+ live_now: false,
+ paid: false,
+ premium: false
+ )
+ end
host_url = make_host_url(Kemal.config.ssl || CONFIG.https_only, CONFIG.domain)
path = env.request.path