Help returning the correct item from an RSS feed that has Attributes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DTeCH
    New Member
    • Apr 2011
    • 23

    Help returning the correct item from an RSS feed that has Attributes

    Hi,


    I'm trying to parse data from an RSS feed, but ever since they added attributes with more than one thingy in the line that i'm trying to parse, I've been stumped.


    I mean I figured it out to this point:
    Code:
    [I]'i.ToString is the index of the current Item being parsed[/I]
    xSize = Rsss1.GetProperty("[B]item[" & i.ToString & "]/newznab:attr[2]@value[/B]")
    parsing from...
    Code:
    <item>
    	<title>Super.Awesome.Movie.2012.DBRip</title>
    	<guid isPermaLink="false">77428c576538422</guid>
    	<link>Long Long Link :)</link>
    	<comments>Some_Link#comments</comments> 	
    	<pubDate>Mon, 16 Jul 2012 21:51:33 +0000</pubDate> 
    	<category>Movies</category> 	
    	<description>Totally awesome flick!!!  lol</description>
    	<enclosure url="http://LongURL" length="14174679056" type="application/x-nzb" />
    
    	<newznab:attr name="category" value="2000" />
    	<newznab:attr name="category" value="2060" />
    	<newznab:attr name="[B]size[/B]" value="[B]14174679056[/B]" />
    	<newznab:attr name="files" value="102" />
    	<newznab:attr name="poster" value="hihi &lt;hihi@kere.ws&gt;" />
    	<newznab:attr name="genre" value="Crime|Drama|Mystery|Thriller" />
    	<newznab:attr name="grabs" value="2" />
    	<newznab:attr name="comments" value="0" />
    	<newznab:attr name="password" value="0" />
    	<newznab:attr name="usenetdate" value="Mon, 16 Jul 2012 21:49:50 +0000" />	
    	<newznab:attr name="group" value="alt.binaries.mom" />
    		
    </item>
    That does the job IF the number of properties are constant for each Item block in the RSS thingy.


    What I want to do is be able to grab... let's say, Mon, 16 Jul 2012 21:49:50 +0000 from:
    Code:
    	<newznab:attr name="category" value="2000" />
    	<newznab:attr name="category" value="2060" />
    	<newznab:attr name="size" value="14174679056" />
    	<newznab:attr name="files" value="102" />
    	<newznab:attr name="poster" value="hihi &lt;hihi@kere.ws&gt;" />
    	<newznab:attr name="genre" value="Crime|Drama|Mystery|Thriller" />
    	<newznab:attr name="grabs" value="2" />
    	<newznab:attr name="comments" value="0" />
    	<newznab:attr name="password" value="0" />
    	<newznab:attr name="[B]usenetdate[/B]" value="[B]Mon, 16 Jul 2012 21:49:50 +0000[/B]" />	
    	<newznab:attr name="group" value="alt.binaries.mom" />
    The entry with usenetdate is what I need to get at no matter where it is in the list... I say this because the way I'm doing it now works until an extra entry is entered, or removed from one of the Items in the feed, & throws the index position off for every Item in the feed. So... the following no longer works because of it:
    Code:
    [I]'i.ToString is the index of the current Item being parsed[/I]
    xSize = Rsss1.GetProperty("[B]item[" & i.ToString & "]/newznab:attr[2]@value[/B]")
    I don't know what to search for in Google, or what element/format/or whatever I'm talking about is, or is called. No clue about format, or whatever.

    Please point your flashlights on this situation for me. I need to be slapped in the right direction because I'm lost right now. :)

    Just show me a format, or something that i can replace what I have right now with... like from:

    Code:
    xSize = Rsss1.GetProperty("[B]item[" & i.ToString & "]/newznab:attr[2]@value[/B]")
    to...
    Code:
    xSize = Rsss1.GetProperty("[B]item[" & i.ToString & "]/newznab:attr/name:size@value[/B]")
    ([I]I haven't got the slightest clue about how to give an example of what to change it to!  lol[/I])


    ps: The component I'm using (Rsss1) is a paid component from nSoftware.com IPWorks SSL V8 (.NET Edition) that accepts XPath?, or whatever else... it just works with whatever I put into the GetProperty part of it. I just don't know how to deal with atributes in the above format of the feed to know what to enter next.

    All help will be greatly appreciated.











    ############### ############### ###




    Ok... this is the longest I've ever waited for an answer on Bytes.com... let me try to ask a different way.

    I would like to get the contents of "value" where "name" is equal to "usenetdate"... but without using indexes, because the index will not be the same for each item block of the RSS feed.
    Code:
    <item>
            <newznab:attr name="category" value="2000" />
            <newznab:attr name="category" value="2060" />
            <newznab:attr name="size" value="14174679056" />
            <newznab:attr name="files" value="102" />
            <newznab:attr name="poster" value="hihi &lt;hihi@kere.ws&gt;" />
            <newznab:attr name="genre" value="Crime|Drama|Mystery|Thriller" />
            <newznab:attr name="grabs" value="2" />
            <newznab:attr name="comments" value="0" />
            <newznab:attr name="password" value="0" />
            <newznab:attr name="[B]usenetdate[/B]" value="[I][B]Mon, 16 Jul 2012 21:49:50 +0000[/B][/I]" />    
            <newznab:attr name="group" value="alt.binaries.mom" />
         
    
    </item>
    I currently use the following to get the info:
    Code:
    xDate = Rsss1.GetProperty("item[9]/newznab:attr[B][I][U][11][/U][/I][/B]@value")
    ...but I need another way that doesn't use [11], because the index will not be the same for the next item block.

    I have tried:
    Code:
    xDate = Rsss1.GetProperty("item[9]/newznab:attr[B][I][U][@name='usenetdate'][/U][/I][/B]@value")
    ...but that doesnt work either. Please help.

    Thanks guys.
Working...