Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: RSS Parse Problem with XML::RSS

by hossman (Prior)
on Sep 16, 2007 at 07:35 UTC ( [id://639231]=note: print w/replies, xml ) Need Help??


in reply to RSS Parse Problem with XML::RSS

You should read the docs for XML::RSS ... in particular look for the method add_module and the section on "RSS 1.0 MODULES"

Replies are listed 'Best First'.
Re^2: RSS Parse Problem with XML::RSS
by subeen (Initiate) on Sep 17, 2007 at 07:07 UTC
    Made some progress with add_module.
    $rss->add_module(prefix=>'dc', uri=>"http://purl.org/dc/terms/"); $rss->add_module(prefix=>'media', uri=>"http://search.yahoo.com/mrss") +; $rss->parse($raw); foreach my $item (@{$rss->{'items'}}) { $title = $item->{'title'}; $media_content_url = $item->{'media'}->{'content'}->{'url'}; $media_keywords = $item->{'media'}->{'keywords'}; print $title, "\n"; print $media_content_url, "\n"; print $media_keywords, "\n"; }
    It prints title and media_keywords, but doesn't show anything for media_content_url. BTW. The RSS I am trying to parse is RSS 2

    Thanks, Subeen.

      Did you try $rss->{link} for the URL?

      You can also use Data::Dumper to inspect $item to see which hash keys are available.

        1. I want the url inside media content (<media:content url="http://www.media.com/***" type="video/windows-wmv" medium="video" width="416" height="312">)
        2. Using dumper I found nothing in media content !!!
        ====================================================== $VAR1 = { 'isPermaLink' => '', 'link' => 'http://www.mtv2.com/music/artist/fat_joe/videos.j +html?partnersearch=fingerprint.video', 'item' => ' ', 'description' => 'MTV2$Bill', 'http://purl.org/dc/terms/' => { 'valid' => ' start=2005-06-13T00:00:00; end=2035-12-31T00:00:00; scheme=W3C-DTF ' }, 'media' => { 'keywords' => 'Fat Joe, MTV2\'s $2Bill Concert +with Fat Joe', 'content' => ' ' }, 'http://search.yahoo.com/mrss' => { 'keywords' => 'Fat Joe, MT +V2\'s $2Bill Concert withFat Joe', 'content' => ' ' }, 'guid' => 'mgid:uma:video:shared:52417', 'title' => 'MTV2\'s $2Bill Concert with Fat Joe', 'category' => 'Type/Concert VideoPerformer/Fat Joe', 'pubDate' => 'Mon, 13 Jun 2005 00:00:00 EDT' }; ======================================================

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://639231]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-03-29 14:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found