]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
hack to support media:content
authorJoey Hess <joeyh@joeyh.name>
Mon, 29 Aug 2022 23:14:17 +0000 (19:14 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 29 Aug 2022 23:14:17 +0000 (19:14 -0400)
This is ugly, but XML::Feed does not support the tag.

CHANGELOG
IkiWiki/Plugin/aggregate.pm

index f33c3bd14d2317de43d328f99ffa3d63ae9dde4e..a30a5de0087b3cce28259e3f7e3fce099a1dc9da 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,7 @@ ikiwiki (3.20200202.4) UNRELEASED; urgency=medium
 
   * aggregate: When a feed has an enclosure that is an image, audio, or
     video, include the enclosure in the generated page.
 
   * aggregate: When a feed has an enclosure that is an image, audio, or
     video, include the enclosure in the generated page.
+  * aggregate: Also support feeds with media:content tags.
 
  -- Joey Hess <id@joeyh.name>  Sat, 25 Dec 2021 12:41:34 -0400
 
 
  -- Joey Hess <id@joeyh.name>  Sat, 25 Dec 2021 12:41:34 -0400
 
index 01e026c880c16d8c04964648c774b718429d7521..2069a352ede751eff1597da5d13e960401e5da48 100644 (file)
@@ -535,6 +535,14 @@ sub aggregate (@) {
                        next;
                }
                my $content=$res->content;
                        next;
                }
                my $content=$res->content;
+
+               # This is a hack to support the media:content extension
+               # to RSS. XML::Feed does not support it, but it's the same
+               # as an enclosure, so converting it to that tag will let it
+               # parse.
+               $content=~s/<media:content/<enclosure/g;
+               $content=~s/<\/media:content/<\/enclosure/g;
+
                my $f=eval{XML::Feed->parse(\$content)};
                if ($@) {
                        # One common cause of XML::Feed crashing is a feed
                my $f=eval{XML::Feed->parse(\$content)};
                if ($@) {
                        # One common cause of XML::Feed crashing is a feed