Grabing photos and item descriptions in ebay

Free BrownRecluse scripts provided by SoftByte Labs and users. To use, copy the script and paste it in the BrownRecluse script editor. Modify to your need, save and run.
Post Reply
Kasper
Posts: 7
Joined: Mon Feb 20, 2012 9:14 am

Grabing photos and item descriptions in ebay

Post by Kasper »

Hi,

I am trying to find a particular item "silk tie" in ebay.com and wish to generate a list of which have the item numbers, seller ID and also grap the item photos to C:\finditem\tie\. In that way, I can save time from clicking each searched pages one by one. Could you help me in preparing that script?

Thanks and Regards,
User avatar
Support
Site Admin
Posts: 3459
Joined: Sun Oct 02, 2011 10:49 am

Re: Grabing photos and item descriptions in ebay

Post by Support »

ok. so you need a script that will search for "something" and for each items displayed, you need to download all the photos for that item, and save the item number and seller ID. In other words, build a text file with the item number, seller ID amd picture(s) name one line per item, all fileds tab delimited?
Your support team.
https://SoftByteLabs.com
Kasper
Posts: 7
Joined: Mon Feb 20, 2012 9:14 am

Re: Grabing photos and item descriptions in ebay

Post by Kasper »

Yes, that's correct. Thanks for your help.
Kasper
Posts: 7
Joined: Mon Feb 20, 2012 9:14 am

Re: Grabing photos and item descriptions in ebay

Post by Kasper »

By the way, can I have the script for that?

Thanks
User avatar
Support
Site Admin
Posts: 3459
Joined: Sun Oct 02, 2011 10:49 am

Re: Grabing photos and item descriptions in ebay

Post by Support »

I'm working on it.
Your support team.
https://SoftByteLabs.com
User avatar
Support
Site Admin
Posts: 3459
Joined: Sun Oct 02, 2011 10:49 am

Re: Grabing photos and item descriptions in ebay

Post by Support »

Here is the script. Just change the first line to whatever keywords you want to search for. The tab delimited file will be saved as ebay.txt in the same folder as this script, and the pictures will be saved in the images folder also in the same folder as this script. The first field is the seller ID, then the item number, then the image file name...

Code: Select all

Keywords = 'silk tie';

PerlRegEx = Yes;
Output.Clear;

Link = New(URL);
temp = New(URL);
rx = New(RegEx);
sx = New(RegEx);
F = New(File);
D = New(File);

D.Open(ScriptPath+'ebay.txt');
D.Truncate;

Keywords.Replace('\s', '+');

NextPage = 'http://www.ebay.com/sch/i.html?_nkw='+Keywords+'&_ipg=200&_sacat=See-All-Categories';

while NextPage do begin

	Link.Get(NextPage);
	NextPage = Decode(WildGet(Link.Data, '<a href="([^"]+_pgn=\d+)"[^>]*><i>Next</i>'));
	if NextPage then NextPage = Link.FixUp(NextPage);

	rx.Data = Link.Data;
	rx.Mask = '<a title="[^"]*" href="([^"]+)" class="[^"]*" r="[^"]*" _sp="[^"]*">';
	rx.Reset;

	while rx.Match do begin
		lnk = Link.FixUp(Decode(rx.Value[1]));
	  ItemNumb = WildGet(lnk, '/itm/[^/]+/([^\?]+)');
		temp.Get(lnk);
		SellerID = WildGet(temp.Data, '<a\s+title="Member\s+id\s+([^"]+)"');
		sx.Data = temp.Data;
		sx.Mask = 'image"\s+content="([^"]+\.jpg)"';
		sx.Reset;
		if sx.Match then begin
			lnk = Decode(sx.Value[1]);
			DecodeURL(lnk, [imgID], [FileName]);
			imgID.Replace('\*', '');
			imgID.Replace('\|', '');
			imgID.Replace('\\', '');
			imgID.Replace('\/', '');
			imgID.Replace('\:', '');
			imgID.Replace('\"', '');
			imgID.Replace('\<', '');
			imgID.Replace('\>', '');
			imgID.Replace('\?', '');
			imgID.Replace('\$', '');
			temp.Get(lnk);
			F.Open(ScriptPath+'images\'+imgID);
			F.Write(temp.Data);
			F.Close;
		end else
		  imgID = '';
    DataLine = SellerID +tab+ ItemNumb +tab+ imgID;
    Output(DataLine);
    D.Write(DataLine+crlf);
	end;

end;

D.Close;
Your support team.
https://SoftByteLabs.com
Kasper
Posts: 7
Joined: Mon Feb 20, 2012 9:14 am

Re: Grabing photos and item descriptions in ebay

Post by Kasper »

Thanks very much for your help. I have tested it and it is really amazing.
Post Reply