Quantcast
Channel: Reading custom values in Ebay RSS feed (XML::RSS module) - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Reading custom values in Ebay RSS feed (XML::RSS module)

$
0
0

I've spent entirely way too long trying to figure this out. I'm using XML: RSS and Perl to read / parse an Ebay RSS feed. Within the <item></item> area, I see these entries:

<rx:BuyItNowPrice xmlns:rx="urn:ebay:apis:eBLBaseComponents">1395</rx:BuyItNowPrice><rx:CurrentPrice xmlns:rx="urn:ebay:apis:eBLBaseComponents">1255</rx:CurrentPrice>

However, I can't figure out how to grab the details during the loop. I wrote a regex to grab them:

@current_price = $item  =~ m/\<rx\:CurrentPrice.*\>(\d+)\<\/rx\:CurrentPrice\>/g;

Which works if you place the above 'CurrentPrice' entry into a standalone string, but not while the script is reading through the RSS feed.

I can grab most of the information I want out of the item->description area (# bids, auction end time, BIN price, thumbnail image, etc.), but it would be nicer if I could grab the info from the feed without me having to deal with grabbing all that information manually.

How to grab custom fields from an RSS feed (short of writing regexes to parse the entire feed w/o a module)?

Here's the code I'm working with:

$my_limit = 0;use LWP::Simple;use XML::RSS;$rss = XML::RSS->new();$data = get( $mylink );$rss->parse( $data );$channel = $rss->{channel};$NumItems = 0;foreach  $item (@{$rss->{'items'}}) {if($NumItems > $my_limit){last;}@current_price = $item =~ m/\<rx\:CurrentPrice.*\>(\d+)\<\/rx\:CurrentPrice\>/g;print "$current_price[0]";}

Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images