mldvx4 has asked for the wisdom of the Perl Monks concerning the following question:
I have encountered an RSS2 feed which fails in the module XML::Feed in regards to finding the datestamp of each entry, either modfied or issued. The feed itself seems to have "PubDate" in the entries, but I am not finding that with XML::Feed or else I am using XML::Feed incorrectly. I've reproduced a stripped down version of it below. How would I find the publication date for the single entry as shown in the demo below?
#!/usr/bin/perl use XML::Feed; use strict; use warnings; my $feed = XML::Feed->parse(\*DATA) or die XML::Feed->errstr; print $feed->title, "\n"; for my $entry ($feed->entries) { print "T=", $entry->title, "\n"; print "\tM=", $entry->modified||$entry->issued, "\n"; } exit(0); __DATA__ <rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"> <channel> <title><![CDATA[ foo bar one ]]></title> <link>https://example.org/rss2.xml</link> <description/> <language>en</language> <copyright>foo bar</copyright> <ttl>120</ttl> <item> <title><![CDATA[ Foo Bar Two ]]></title> <link>https://www.example.org/</link> <description><![CDATA[ <p align="center"> <span style="font-size: 0.75em;"> </span></p> <p>words words words</p> ]]></description> <pubDate>2019-09-10 13:38:00</pubDate> <guid isPermaLink="false">https://example.org/</guid> <dc:creator>foo bar three</dc:creator> </item> </channel> </rss>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: RSS finding date of publication using XML::Feed
by poj (Abbot) on Sep 11, 2019 at 18:13 UTC | |
by mldvx4 (Hermit) on Sep 12, 2019 at 15:05 UTC | |
by poj (Abbot) on Sep 12, 2019 at 15:24 UTC |