Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
When I run the script I get this output:#!/usr/bin/perl use XML::Feed; use Data::Dumper; my $rssurl = "http://librivox.org/rss/4273"; my $feed = XML::Feed->parse(URI->new($rssurl)) or die XML::Feed->errstr; print $feed->title, "\n"; print $feed->description, "\n"; for my $entry ($feed->entries) { # print "entery is [$entry]\n"; # print Dumper( $entry ); print $entry->title, "\n"; print $entry->{'http://www.itunes.com/dtds/podcast-1.0.dtd +'}{'duration'} . "\n"; print $entry->duration . "\n"; }
If I addConquest Over Time by SHAARA, Michael <p>Pat Travis, a spacer renowned for his luck, is suddenly quite o +ut of it. His job is to beat his competitors to sign newly-Contacted +human races to commercial contracts... But what can he do when he finds he's on a planet that consults as +trology for literally every major decision - and he has arrived on on +e of the worst-aspected days in history? Michael Shaara, later to write the Pulitzer-winning novel "The Kil +ler Angels", wrote this story for Fantastic Universe in 1956. (Summar +y by Mark F. Smith)</p> 1 - Section 1 Can't locate object method "duration" via package "XML::Feed::Entry::F +ormat::RSS" at ./get_feed.pl line 15.
for debugging I can see this bit of data:print Dumper( $entry );
The piece of data I want is the duration '00:20:00'. How do I get that in my script? Thanks!$VAR1 = bless( { 'entry' => { 'enclosure' => { 'length' => '9.6MB', 'url' => 'http://www. +archive.org/download/conquest_over_time_1005_librivox/conquestovertim +e_1_shaara_64kb.mp3', 'type' => 'audio/mpeg +' }, 'link' => 'http://www.archive.org/do +wnload/conquest_over_time_1005_librivox/conquestovertime_1_shaara_64k +b.mp3', 'item' => ' ', 'http://www.itunes.com/dtds/podcast- +1.0.dtd' => { + 'explicit' => 'No', + 'duration' => '00:20:00', + 'block' => 'No' + }, 'title' => '1 - Section 1' }, '_version' => '2.0' }, 'XML::Feed::Entry::Format::RSS' );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to extract data from rss feed using XML::Feed
by Anonymous Monk on Feb 09, 2014 at 03:38 UTC | |
by Anonymous Monk on Feb 09, 2014 at 03:51 UTC |