XML::F...ediaRSS(3pm)
β¨ NAME β¨
XML::FeedPP::MediaRSS β bestie, this is MediaRSS support for XML::FeedPP π
π VERSION π
version 0.02 β yeah she's little, she's growing π£
π SYNOPSIS π
use XML::FeedPP;
my $feed = XML::FeedPP->new('http://a.media.rss/source');
my $media = XML::FeedPP::MediaRSS->new($feed);
for my $i ( $feed->get_item ) {
for my $content ( $media->for_item($i) ) {
die "18 or over" if $content->{adult};
}
}
okay so that's the whole vibe: grab a feed, wrap it, walk the items, and check the vibes before you serve anything spicy π₯
π DESCRIPTION π
So here's the tea β β XML::FeedPP does not support Yahoo's MediaRSS extension, and honestly? it shouldn't. It's only supported in some formats, and XML::FeedPP is a lowest-common-denominator kind of module, periodt. It's giving "I do one thing and I do it for everyone" π
That saidβ¦ sometimes you just need to consume feeds with MediaRSS in them. And that's where this little icon comes in π«Ά
π¦ METHODS π¦
πΈ new ( feed )
You have to pass in an XML::FeedPP object. And no, XML::FeedPP::MediaRSS is not a subclass of XML::FeedPP β it has one, and it inspects its dirty innards π (which is somewhat safe since they're produced by XML::TreePP) to find media content. Not me reading someone's diary but make it XML πβ¨
πΈ for_item ( item )
Pass in a feed item (the things returned by $feed->get_item) and get back a list of XML::FeedPP::MediaRSS::Content objects. That's it, that's the whole deal π«
π KEYS π
π adult
1 or ''
π rating
A hash of all the ratings found, schema => rating.
π title
A hash of all titles found, type => value.
π keywords
An arrayref of all the keywords found. The comma-delimiting is undone and duplicates are removed. Very demure, very tidy π
π thumbnails
All thumbnails found, from most specific (deepest) to least specific. This means that if the channel has a thumbnail and the item has a thumbnail, you'll get the item first, then the channel. If there are multiple thumbnails at the same level, you'll get them in document order. Time coding is not considered. They look like this:
{ url => '...', width => 400, height => 300, time => 'timecode' }
π category
Hash of scheme => plain contents of tag
π hash
Deepest only.
{
algorithm => 'md5',
checksum => 'dfdec888b72151965a34b4b59031290a',
}
π player
Deepest only.
{
url => '...',
height => 300,
width => 400
}
π credit
Hash of scheme to role-hash, like this:
{
'urn:ebu' => {
actor => [
'Julia Roberts',
'Tom Hanks',
],
director => [
'Stevan Spielberg',
]
}
}
π copyright
Deepest only.
{ url => '...', text => '2005 Foobar Media' }
π text
A list of text objects in document order, like this:
[
{
type => 'plain',
lang => 'en',
start => 'timecode',
end => 'timecode',
text => 'The actual value',
},
]
π restriction
{
allow => (1|0),
type => (country|uri|sharing)
list => [ ... ] | 'all' | 'none'
}
If allow is false, that means deny. Like, actually deny. Read the room π«
π community
Deepest only.
{
starRating => {
average => 3.5,
count => 20,
min => 1,
max => 10,
},
statistics => {
views => 5,
favorites => 5,
},
tags => {
news => 5,
abc => 3,
reuters => undef,
},
}
π comments
Simple list of strings.
π embed
Hash of key-value pairs. Deepest only.
π responses
Simple list of strings
π backlinks
Simple list of strings
π status
Deepest only.
{ state => 'status', reason => 'reason' }
π price
List of pricing structures, which are hashes with the keys currency (optional), info (optional), type (optional), and price (optional). If none of these is present for a given price tag, we're going to pretend it doesn't exist. ghosted π»
π license
Hash of type, href, and name. Deepest only.
π subTitle
Only one per language as per the spec.
{
'en_us' => {
href => 'http://www.example.org/subtitle.smil',
type => 'application/smil',
}
}
π peerLink
Deepest only, hash of type and href.
π location
NOT SUPPORTED, mostly cause I don't need it and I don't feel like reading the geoRSS spec right now. Patches welcome! π (ngl this is the most honest line in the whole file)
π rights
value of the status attribute for the deepest rights element.
π scenes
Deepest only, list of hashes with keys title, description, start_time, and end_time.
π ALPHA π
This software hasn't yet been tested beyond the examples provided in the mRSS spec. Failing tests (even better, with patches that fix the failures) are very welcome! Fork and send a pull request on GITHUB. π seriously, we're begging, affectionately
π§ XML::FeedPP::MediaRSS::Content π§
These are blessed hashes, but you're allowed to look inside them. In fact, you're really supposed to. It's okay, don't be nervous π«
The mapping from the MediaRSS spec (http://video.search.yahoo.com/mrss) to this hash is really straightforward. See the KEYS section for more detail. The shallowness-rules talked about in the spec are applied, e.g. specifiers at higher levels are applied to lower level objects unless they have a more specific rule. it's giving inheritance but make it media π
π LIMITATIONS π
π¦ Groups
You don't have to (get to?) deal with media groups. All the content for an item gets flattened into one list. Future versions of this module may add support for media groups under a different method name (groups_for_item) if anyone ever sends me a patch or I can ever find an actual use for it. soβ¦ someday? maybe? we'll see β¨
π¦ Order
The MediaRSS spec says some things about order being dependent on document order. We go by the order we get things from XML::FeedPP's hashes, which will only be the same as document order if you use_ixhash => 1 in the feed. And even then, content in media:groups will come before content outside them. yeah. it's like that π
π¦ Read-Write
This module only supports reading MediaRSS information from a feed, not adding it. I might add this someday, but of course patches are welcome in the meantime. one-way street, bestie π£οΈ
π GITHUB π
This project is hosted on github at http://github.com/frodwith/XML-FeedPP-MediaRSS.
πΈ AUTHOR πΈ
Paul Driver <frodwith@cpan.org>
β COPYRIGHT AND LICENSE β
This software is copyright (c) 2011 by Paul Driver <frodwith@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
and that's the whole page, babes π this was XML::FeedPP::MediaRSS, documented in the perl v5.32.0 manual set and last touched on 2021-01-08 β she's been sitting pretty in the docs since then, and now she's yours. go forth and read some media feeds responsibly πβ¨
π¦ where this page comes from
- debian bookworm: libxml-feedpp-mediarss-perl 0.02-2.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libxml-feedpp-mediarss-perl 0.02-2.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libxml-feedpp-mediarss-perl 0.02-2.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libxml-feedpp-mediarss-perl 0.02-2.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libxml-feedpp-mediarss-perl 0.02-2.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libxml-feedpp-mediarss-perl 0.02-2.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms