shlomif / perl-xml-rss Goto Github PK
View Code? Open in Web Editor NEWThe Repository for the CPAN XML::RSS module for parsing and generating various versions of RSS.
License: Other
The Repository for the CPAN XML::RSS module for parsing and generating various versions of RSS.
License: Other
Copyright (c) 2001 Jonathan Eisenzopf and Rael Dornfest. Copyright (c) 2006-2007 Ask Bjoern Hansen, Develooper LLC. All rights reserved. This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This module was created to help those who need to manage RDF Site Summary (RSS) files. It makes quick work of creating, updating, and saving RSS files. perldoc lib/XML/RSS.pm https://metacpan.org/pod/XML::RSS for more details. REQUIREMENTS This module requires version 2.23 or greater of the XML::Parser module. The latest version is available at any CPAN archive. INSTALLATION perl Makefile.PL make make test # (optional) make install
In the release version 1.62, I see lines 1, 2, 19 respectively contain:
package XML::RSS;
$XML::RSS::VERSION = '1.62';
...
$VERSION = '1.59';
I don't see that line 2 in github, so I suspect it is being injected by a release process, and that at the point the release process was added line 19 should have been removed.
This has caused a bit of confusion on PerlMonks.
@shlomif, i have seen (and understand) your comments that updating XML::RSS
is not a priority for you, but i was hoping that you might at least be able to shed some light on what i am seeing, and others have observed as well.
is this behavior (DublinCore
tags output in 1.0, but not 2.0) intentional (ie, DublinCore
is not compatible with RSS 2.0 because of the spec), or is it because the code has not been updated to reflect the compatibility, or for some other reason?
i simply want to avoid the situation where i patch things locally, thinking that it is a bug, only to discover that it was a feature, and that my "fix" is producing poorly-formatted RSS.
TIA
Parsing a file with a custom field type which is both multiple and empty fails to retrieve the data.
Example file:
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:torznab="http://torznab.com/schemas/2015/feed">
<channel>
<title>Channel Title</title>
<description>Channel Description</description>
<link>http://example.com/</link>
<language>en-US</language>
<category>search</category>
<item>
<title>Candle.Cove.S01E01.720p</title>
<category>100041</category>
<category>5040</category>
<description>Candle Cove, Season One, Episode One. The gang flail and scream while Janice cries.</description>
<enclosure url="https://example.com/path/to/7585482b-2c10-4346-9075-fd3b586eaf16" length="72351744" type="application/x-bittorrent" />
<guid>https://example.com/path/to/7585482b-2c10-4346-9075-fd3b586eaf16</guid>
<link>https://example.com/path/to/7585482b-2c10-4346-9075-fd3b586eaf16</link>
<pubDate>Sat, 19 Dec 2022 23:59:59 +1000</pubDate>
<size>72351744</size>
<torznab:attr name="peers" value="333" />
<torznab:attr name="seeders" value="999" />
<type>public</type>
</item>
</channel>
</rss>
Example script:
use v5.10;
use XML::RSS;
use Data::Dumper;
my $rss = XML::RSS->new();
$rss->parsefile( 'torznab-example.xml',
{ allow_multiple => ['attr'] } );
say Dumper( $rss->{items}->[0] );
does not retrieve the details of these two fields:
<torznab:attr name="peers" value="333" />
<torznab:attr name="seeders" value="999" />
I have added some code so that an allow_empty
array can be passed in the parse step:
use v5.10;
use XML::RSS;
use Data::Dumper;
my $rss = XML::RSS->new();
$rss->parsefile(
'/Users/john/Library/Scripts/torznab-example.xml',
{ allow_multiple => ['attr'], allow_empty => ['attr'] }
); ### `allow_empty` argument
say Dumper( $rss->{items}->[0] );
retrieves the elements (relevant section):
'http://torznab.com/schemas/2015/feed' => {
'attr' => [
{
'name' => 'peers',
'value' => '333'
},
{
'value' => '999',
'name' => 'seeders'
}
]
},
I will make a pull request.
I'm using XML::RSS 1.62 to generate different RSS versions of the same feed. However, when content
argument of add_item method is set to anything else then empty string RSS 1.0 generation fails with the following error:
Don't know how to handle module data of type ! at /usr/local/share/perl5/XML/RSS/Private/Output/Base.pm line 760, <DATA> line 1.
How should the content
argument be set, so to avoid error?
The parser should only use link tags that are direct children of the item node for the link, not link tags located somewhere deeper in the structure. For example the following XML results in the parsed item's link being SOME_URLSOME_TEXT
instead of SOME_URL
:
<item>
<link>SOME_URL</link>
<some_custom_tag>
<link>SOME_TEXT</link>
</some_custom_tag>
...
</item>
Real life example where this bug breaks item URLs: https://aif.ru/rss/all.php
Looking at module's page at CPAN I do not see a way to generate self link to channel, which is reported as "Missing atom:link with rel=self" by W3C's Feed Validation Service. The related doc explains the meaning of the message. Is it possible to add self link to channel?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.