Parse Informations of the RSS Feed into the Post-Processing

Come up with a useful post-processing script? Share it here!
Post Reply
CoDeX2k
Newbie
Newbie
Posts: 12
Joined: February 2nd, 2010, 8:16 am

Parse Informations of the RSS Feed into the Post-Processing

Post by CoDeX2k »

Hello,

I wanted to ask if I can somehow access <item><title> and <item>description> of the rss feed I am importing into sabnzbd for post processing?

For example:
<item>
<title>Test.Movie.XViD-TestGroup</title>
<link>http://www.testnzb.com/test.nzb</link>
<description>http://www.imdb.com/title/tt0000000/</description>
<pubDate>Mon, 14 Nov 2011 21:47:06 GMT</pubDate>
</item>

So I can access the title and the description for post-processing.

Would be cool for my script.

Thanks a lot for your help guys.

Cheers,
CoDeX2k
User avatar
sander
Release Testers
Release Testers
Posts: 8867
Joined: January 22nd, 2008, 2:22 pm

Re: Parse Informations of the RSS Feed into the Post-Process

Post by sander »

Here's some ugly code to get the info.

Code: Select all

sander@R540:~$ cat rss-stuff.txt  | grep '<title>' | awk -F\> '{ print $2 }' | awk -F\< '{ print $1 }' 
Test.Movie.XViD-TestGroup
sander@R540:~$ 

sander@R540:~$ 
sander@R540:~$ cat rss-stuff.txt  | grep '<description>' | awk -F\> '{ print $2 }' | awk -F\< '{ print $1 }' 
http://www.imdb.com/title/tt0000000/
sander@R540:~$
But it all depends on the OS you're using, ... which you didn't specify. And it depends on the programming language you're able to program yourself.
CoDeX2k
Newbie
Newbie
Posts: 12
Joined: February 2nd, 2010, 8:16 am

Re: Parse Informations of the RSS Feed into the Post-Process

Post by CoDeX2k »

Hi Sander,

Thanks a lot for your reply.

I wanted to do this script on my QNap NAS. Which is Linux based. So the code you wrote helps me a lot.

Just to make sure I am dont missing something. I have to wget the rss.xml first to make the cat etc. stuff with it. Right? I can not cat something from the web?

Cheers
CoDeX2k
User avatar
sander
Release Testers
Release Testers
Posts: 8867
Joined: January 22nd, 2008, 2:22 pm

Re: Parse Informations of the RSS Feed into the Post-Process

Post by sander »

The 'mang wget' says this:

Code: Select all

       -O file
       --output-document=file
           The documents will not be written to the appropriate files, but all will be concatenated together and written to file.  If - is used as file, documents
           will be printed to standard output, disabling link conversion. 
HTH
CoDeX2k
Newbie
Newbie
Posts: 12
Joined: February 2nd, 2010, 8:16 am

Re: Parse Informations of the RSS Feed into the Post-Process

Post by CoDeX2k »

Wow. Thanks for the fast reply.

Works.

One last thing. Now I know how to access the <title> and <description> of this rss.xml but how can I compare my test.nzb to the right item entry of this .xml? Because lets say the xml looks like this:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>RSS Feed</title>
    <link>rss.asdfasdf.com</link>
    <description>RSS Feed</description>
    <copyright>Blablabla</copyright>
    <ttl>5</ttl>
    <lastBuildDate>Tue, 15 Nov 2011 17:22:08 GMT</lastBuildDate>
    <item>
      <title>Test.Movie.XViD-TestGroup</title>
      <link>http://www.testnzb.com/test.nzb</link>
      <description>http://www.imdb.com/title/tt0000000/</description>
      <pubDate>Mon, 14 Nov 2011 22:18:18 GMT</pubDate>
    </item>
    <item>
      <title>Test.Movie.2.XViD-TestGroup</title>
      <link>http://www.testnzb.com/test1.nzb</link>
      <description>http://www.imdb.com/title/tt0000001/</description>
      <pubDate>Mon, 14 Nov 2011 21:47:06 GMT</pubDate>
    </item>
  </channel>
</rss>
And now sabnzbd downloads the test.nzb how can I compare the test.nzb (variable $2 if I am correct) with the full xml and only get the <title> and <description> of the correct item back?
User avatar
Mar2zz
Jr. Member
Jr. Member
Posts: 85
Joined: February 4th, 2011, 8:30 am
Contact:

Re: Parse Informations of the RSS Feed into the Post-Process

Post by Mar2zz »

if grep $2 rss.xml; then etc

only these
grep '<description>' rss.xml | sed 's/<*escription>//g'
grep '<title>' rss.xml | sed's/<*itle>//g'

grep has more function if multiple title/descriptions are found.
exussum
Jr. Member
Jr. Member
Posts: 79
Joined: November 18th, 2010, 2:51 am

Re: Parse Informations of the RSS Feed into the Post-Process

Post by exussum »

The way ive done it in the past is set the rss feed to be a php script i have control of which accesses the RSS feed and passes any extra info needed to it. May be a bit overkill though
CoDeX2k
Newbie
Newbie
Posts: 12
Joined: February 2nd, 2010, 8:16 am

Re: Parse Informations of the RSS Feed into the Post-Process

Post by CoDeX2k »

I am having troubles with the $2 variable because its not really the link variable it is the download name...

for example:
<link>TOWN-www.town.ag-sponsored-by-www.ssl-news.info-Alles.Koscher.DVDRiP.MD.German.XViD-CIS.par2-74422-MB.nzb</link>

is
Another.Earth.BDRip.MD.German.XViD-CIS.par2

is there a trick? or should I just search for %"$2"%?
User avatar
sander
Release Testers
Release Testers
Posts: 8867
Joined: January 22nd, 2008, 2:22 pm

Re: Parse Informations of the RSS Feed into the Post-Process

Post by sander »

CoDeX2k wrote:I am having troubles with the $2 variable because its not really the link variable it is the download name...

for example:
<link>TOWN-www.town.ag-sponsored-by-www.ssl-news.info-Alles.Koscher.DVDRiP.MD.German.XViD-CIS.par2-74422-MB.nzb</link>

is
Another.Earth.BDRip.MD.German.XViD-CIS.par2

is there a trick? or should I just search for %"$2"%?
(If I understand you correctly, I would say this:)

The download name can be completely unrelated; it can be even be "3838329802.NZB"; that filename is generated by the search engine (like binsearch.info), or more generally speaking: the webserver providing the .NZB file. The linking pin is *in* that NZB. So maybe you can find the NZB, and then search it?
CoDeX2k
Newbie
Newbie
Posts: 12
Joined: February 2nd, 2010, 8:16 am

Re: Parse Informations of the RSS Feed into the Post-Process

Post by CoDeX2k »

I solved it by editing the link path with the save name I get from nzbindex.nl instead of the download link name.
Post Reply