A while back I had a thought that maybe there were people on eBay who were selling lots of $1 items fairly and ripping people off on a few $1000 items - and maintaining 99%+ positive feedback. To test this theory I wrote this perl script, which trawls the feedback of the user you specify and tells you how many $ of positive, negative and neutral feedback a user has. To try it, copy and paste the code below into a file called dollarfeedback.pl and run it by typing ./dollarfeedback.pl userid eg. ./dollarfeedback.pl phillsebayid
#!/usr/bin/perl
use LWP::Simple;
print "Ebay \$ feedback calculator\n";
$uid = $ARGV[0];
$max_items = 500;
print "Username = $uid\n";
$items_counted = 0;
do
{
$found=0;
$page++;
$url = "http://feedback.ebay.com/ws/eBayISAPI.dll?ViewFeedbackFromBuyers&userid=$uid&items=200&page=$page";
print "Getting $url\n";
$_=get($url);
s/@/x/g;
s/\^/x/g;
s/~/x/g;
s/\*/x/g;
s/\"Positive feedback rating\"/@/g;
s/\"Negative feedback rating\"/\^/g;
s/\"Neutral feedback rating\"/~/g;
s/\ViewItem&item=/*/g;
while($_=~m/[^\^@~]*([@\^~])[^\*]*\*([0-9]*)/gs && items_counted<$max_items) { $found=1; $item_number=$2; $feedback_type=$1; $item_price=&get_price($item_number); if($item_price == -1) { next; } $dollar_feedback{$feedback_type}+=$item_price; $item_feedback{$feedback_type}++; $items_counted++; print "$uid : Item $items_counted : Item number $item_number : Price $item_price : Feedback $feedback_type\n"; } $_=~m/Positive Feedback:[^0-9]*([0-9]*)/g; $eBay_feedback_percent = $1; }while(m/>Next<\/a>/g && $found==1);# && items_counted<$max_items); if($items_counted==0) { print "No items for $uid\n"; } else { $percentage_positive_feedback_dollar = ($dollar_feedback{"@"} * 100 / ($dollar_feedback{"@"} + $dollar_feedback{"^"} + $dollar_feedback{"~"})); $percentage_positive_feedback_item = ($item_feedback{"@"} * 100 / ($item_feedback{"@"} + $item_feedback{"^"} + $item_feedback{"~"})); print "User: $uid, eBay Positive Feedback Rating: $eBay_feedback_percent%\n"; print "Items sold that are still on record: $items_counted\n"; print "Positive feedback total: " . $item_feedback{"@"} . " items totalling " . $dollar_feedback{"@"} . " dollars\n"; print "Negative feedback total: " . $item_feedback{"^"} . " items totalling " . $dollar_feedback{"^"} . " dollars\n"; print "Neutral feedback total: " . $item_feedback{"~"} . " items totalling " . $dollar_feedback{"~"} . " dollars\n"; print "Positive feedback % in terms of items: " . $percentage_positive_feedback_item . "%\n"; print "Positive feedback % in terms of dollars: " .$percentage_positive_feedback_dollar . "%\n"; open (OUTFILE, ">>datafile.csv");
print OUTFILE "$uid,$eBay_feedback_percent,$items_counted," . $item_feedback{"@"} . "," . $dollar_feedback{"@"} . "," .
$item_feedback{"^"} . "," . $dollar_feedback{"^"} . "," . $item_feedback{"~"} . "," . $dollar_feedback{"~"} . "," .
$percentage_positive_feedback_item . "," . $percentage_positive_feedback_dollar . "\n";
close OUTFILE;
}
sub get_price
{
my $item=shift;
$item_data=get("http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=$item");
$price=-1;
if($item_data=~m/\"DetailsCurrentBidValue\"><b>AU \$([0-9\.]*)/g)
{
$price=$1;
}
elsif($item_data=~m/\"Buy It Now\"/g && $item_data=~/<\/span><\/td><b>AU \$([0-9\.]*)/g)
{
$price=$1;
}
$price;
}
My apologies in advance for my less than spectacular Perl code (and blogger killing my formatting!), but it does the job :) Please let me know if you like it, and any cool dirt you dig up with it.
Update: I'm doing some experiments with this code on my other blog Tech Sleuth. Come see what dirt I dig up!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment