hack to support media:content

This is ugly, but XML::Feed does not support the tag.
master
Joey Hess 2022-08-29 19:14:17 -04:00
parent 90b3140fff
commit 4a5cab56d0
No known key found for this signature in database
GPG Key ID: DB12DB0FF05F8F38
2 changed files with 9 additions and 0 deletions

View File

@ -2,6 +2,7 @@ ikiwiki (3.20200202.4) UNRELEASED; urgency=medium
* aggregate: When a feed has an enclosure that is an image, audio, or * aggregate: When a feed has an enclosure that is an image, audio, or
video, include the enclosure in the generated page. 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

View File

@ -535,6 +535,14 @@ sub aggregate (@) {
next; next;
} }
my $content=$res->content; 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)}; my $f=eval{XML::Feed->parse(\$content)};
if ($@) { if ($@) {
# One common cause of XML::Feed crashing is a feed # One common cause of XML::Feed crashing is a feed