Giter Club home page Giter Club logo

perl-xml-rss's Introduction

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

perl-xml-rss's People

Contributors

choroba avatar dsteinbrunner avatar hoelzro avatar johnhorner avatar shlomif avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

perl-xml-rss's Issues

Version is set twice

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.

DublinCore tags not output in RSS 2.0 feed

@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

No way to specify elements which may be empty

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.

Setting content argument of add_item method fails RSS 1.0 generation

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?

Nested custom link tags break item links

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.