summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorshironeko <shironeko@tesaguri.club>2024-02-08 17:05:11 -0500
committershironeko <shironeko@tesaguri.club>2024-02-08 17:05:11 -0500
commitc864a63b6d86cb7552d2f1730731e427fc435fe4 (patch)
tree5d672e3a9d19167d9a987fa58e729f23297ef36d /src
parentc005ada48723808e507d0a4d5a3363a1c14a4f07 (diff)
downloadinvidious-c864a63b6d86cb7552d2f1730731e427fc435fe4.tar.gz
invidious-c864a63b6d86cb7552d2f1730731e427fc435fe4.tar.bz2
invidious-c864a63b6d86cb7552d2f1730731e427fc435fe4.zip
Fix pubsub feed parsing
similar to what's done in #3793, this is causing an assert on my instance
Diffstat (limited to 'src')
-rw-r--r--src/invidious/routes/feeds.cr17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/invidious/routes/feeds.cr b/src/invidious/routes/feeds.cr
index 40bca008..512d4ee7 100644
--- a/src/invidious/routes/feeds.cr
+++ b/src/invidious/routes/feeds.cr
@@ -407,12 +407,17 @@ module Invidious::Routes::Feeds
end
spawn do
- rss = XML.parse_html(body)
- rss.xpath_nodes("//feed/entry").each do |entry|
- id = entry.xpath_node("videoid").not_nil!.content
- author = entry.xpath_node("author/name").not_nil!.content
- published = Time.parse_rfc3339(entry.xpath_node("published").not_nil!.content)
- updated = Time.parse_rfc3339(entry.xpath_node("updated").not_nil!.content)
+ # TODO: unify this with the other almost identical looking parts in this and channels.cr somehow?
+ namespaces = {
+ "yt" => "http://www.youtube.com/xml/schemas/2015",
+ "default" => "http://www.w3.org/2005/Atom",
+ }
+ rss = XML.parse(body)
+ rss.xpath_nodes("//default:feed/default:entry", namespaces).each do |entry|
+ id = entry.xpath_node("yt:videoId", namespaces).not_nil!.content
+ author = entry.xpath_node("default:author/default:name", namespaces).not_nil!.content
+ published = Time.parse_rfc3339(entry.xpath_node("default:published", namespaces).not_nil!.content)
+ updated = Time.parse_rfc3339(entry.xpath_node("default:updated", namespaces).not_nil!.content)
video = get_video(id, force_refresh: true)