[Chicago-talk] ItemId
Ed Summers
ehs at pobox.com
Tue Jan 6 14:44:39 CST 2004
On Tue, Jan 06, 2004 at 12:58:25PM -0600, petemar1 wrote:
> Any ideas?
Have you looked at WWW::Search::Ebay [1]?
#!/usr/bin/perl
use WWW::Search;
my $search = new WWW::Search('Ebay');
my $query = WWW::Search::escape_query("digital camera");
$search->native_query( $query );
while ( my $result = $search->next_result() ) {
my ( $item, $bids, $bid ) = split/; /, $result->description();
print "$item\n";
}
//Ed
[1] http://search.cpan.org/perldoc?WWW::Search::Ebay
>
>
>
> #!/usr/local/bin/perl -w
>
> use strict;
> use warnings;
> use FindBin::libs;
> use WWW::Mechanize;
> use LWP::UserAgent;
> use HTTP::Request;
> use HTTP::Response;
> use URI::Heuristic;
>
> my $url;
> my $ua;
> my $req;
> my $response;
> my $content;
> my $title;
>
> my $sec;
> my $min;
> my $hour;
> my $mday;
> my $mon;
> my $year;
> my $wday;
> my $yday;
> my $isdst;
> my $realmonth;
> my $realday;
> my $realyear;
> ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
> localtime(time);
> $realmonth = $mon + 1;
> $realday = $mday - 1;
> $realyear = $year + 1900;
>
> my $user = 'username';
> my $pass = 'password';
> # my $message = 'Testing...';
>
> my $a = WWW::Mechanize->new();
> #$a->get('http://search-completed.ebay.com/search/search.dll?GetResult&rfisa
> ctive=1®ion=0&max
> recordsperpage=50&from=R14&query=canon+digital+camera+-battery+-case+-cable+
> -card+-memory+-camco
> rder&ht=1&completedonly=1');
> $a->get('http://signin.ebay.com/aw-cgi/eBayISAPI.dll?SignIn&UsingSSL=0&pUser
> Id=aneyusor&ru=http%
> 3A%2F%2Fcgi1.ebay.com%2Faw-cgi%2FeBayISAPI.dll%3FMyEbayLogin&pp=pass&pageTyp
> e=174&i1=0');
>
> $a->submit_form(
> form_number => 2,
> fields => {
> userid => $user,
> pass => $pass,
> },
> );
>
> print "logged in!\n";
>
> $a->follow_link('http://pages.ebay.com/search/items/basicsearch.html?ssPageN
> ame=h:h:fitem:US');
> print "Moved to Search page!\n";
>
> $a->follow_link('http://pages.ebay.com/search/items/search_adv.html');
> print "Moved to Advanced Search page!\n";
>
>
> my $littlesearch = $a->submit_form(
> form_number => 1,
> fields => {
> ht => '1',
> query => 'canon digital camera',
> # exclude => 'battery case cable card memory camcorder',
> # completedOnly => '1',
> # maxRecordsPerPage => '100',
> },
> );
>
>
> #print "submitted search!\n";
>
>
> ##########
>
> $url =
> URI::Heuristic::uf_urlstr("http://search-completed.ebay.com/search/search.dl
> l?GetResult&r
> fisactive=1®ion=0&maxrecordsperpage=50&from=R14&query=canon+digital+camer
> a+-battery+-case+-ca
> ble+-card+-memory+-camcorder&ht=1&completedonly=1");
> #$| = 1;
>
> #$ua = LWP::UserAgent->new();
> #$ua->agent("Mozilla/v5.0");
> #$req = HTTP::Request->new(GET => $url);
> #$req->referer("http://localhost.localdomain");
>
> #$a->get('http://search-completed.ebay.com/search/search.dll?GetResult&rfisa
> ctive=1®ion=0&max
> recordsperpage=100&from=R14&query=canon+digital+camera+-battery+-case+-cable
> +-card+-memory+-camc
> order&ht=1&completedonly=1');
> #$a->get($url);
>
> print "\nGetting url...\n";
>
> #$response = $a->request($req);
> #$response = $a->get($url);
> $response = $littlesearch;
> if ($response->is_error())
> {
> printf "%s\n", $response->status_line;
> }
> else
> {
> $title = $response->title();
> $content = $response->content();
>
> open(NETDATA, ">>netdata.txt");
>
> printf "\nFrom: %s\n", $title;
> print NETDATA "\n";
>
> printf NETDATA "%02d/%02d/%04d, %02d:%02d:%02d CST\n",
> $realmonth,$mday,$realyear,$hour,
> $min,$sec;
> print "\n";
>
> # while($content != <>){
> print NETDATA "ITEM ID : ";
> #print NETDATA $content =~
> m/ViewItem&item=(.*?)&category=/s;
> print NETDATA $content =~ m/ViewItem&item=(\d*)&category=/s;
> print NETDATA "\n";
> # }
>
>
> close(NETDATA);
>
> }
>
>
> print "\n";
> print "\nDone! Exiting.\n";
> exit;
>
>
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at mail.pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
>
--
Ed Summers
aim: inkdroid
web: http://www.inkdroid.org
I wish to God these calculations had been executed by steam! [Charles Babbage]
More information about the Chicago-talk
mailing list