Finally 10 posts....On with the question...
I am writing a script that searches ebay and amazon for the product number of a product (of course), finds only the price and returns the price. Pretty simple, however, I am just beginning perl and I need a bit of help...
Here is the script so far....
First of all, how would I have the program determine the price of the product? Possibly look for the info that had been declared "price" in the css? ...and thats about it. Help, and a definite answer maybe...(>.> <.<) would be greatly appreciated.Code:use LWP; use LWP 5.64; use URI; LWP::Simple my $browser = LWP::UserAgent->new; $prod = <>; my $url = URI->new( 'http://www.amazon.com/s/ref=nb_ss_gw?url=search-alias%3Dtools&field-keywords=$prod;' ); $url->query_form{ 'product number' => <>; } my $response = $browser->get( $url );
Thanks.
Wow, the Perl forum doesn't get much attention...Anyone want to help me out?
You posted on two of the slowest perlk forums on the internet, I answered on the other
one :
Price Finding....
(Its not much help though)
I suggest you post on tek-tips or devshed or perlmonks (not all of them at the same time) if you really want help. This forum and tizag are very slow as far as perl goes.
I guess you wish to make something like this
Code:use warnings; use strict; use LWP::UserAgent; my $ua = LWP::UserAgent->new(); die usage() if !$ARGV[0]; my $res = $ua->get('hxxp://www[dot]amazon[dot]com/s/ref=nb_ss_gw?url=search-alias%3Dtools&field-keywords='.$ARGV[0]); # edit can't post links my @price = $res->content =~ m/(\$\d+)/gs; foreach(@price) { print "$_\n"; } #print $res->content; sub usage { print "Usage perl $0 product\n"; }
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks