Using Google’s Xpath scraping with ebay for average cost.

Written by Arujei on . Posted in Latest

Well with Christmas shopping/selling on the way sometimes I like to get the average cost of something that has sold on ebay. Well instead of doing all that math of copy everything I see sold and dividing it by the number of items I copied. I went ahead and scrapped their data into a Google apps spreadsheet to get the answer.

Its easy to do.

1. Go to ebay search for something you want the average price on. Make sure you check “completed listings” within the “buying formats” preferences.

2. Once you get the results you want copy ebay address in your address bar.

3. Either open the Google spreadsheet here and replace the ebay address with your’s.
https://docs.google.com/spreadsheet/ccc?key=0AiOZ9Umamg_WdEhScWlQTmFuSXdlUG56Q05HcXBrdGc#gid=0

3b. Or you can make your spreadsheet and copy and paste this. Replacing the ebay address in quotes with your’s.

=average(ImportXML("http://www.ebay.com/sch/Cell-Phones-Smartphones-/9355/i.html?Storage%2520Capacity=32%2520GB&Color=Black&LH_ItemCondition=3000&Carrier=AT%2526T&Model=iPhone%25204&_dmpt=Cell_Phones&_nkw=iPhone%204&rt=nc&LH_PrefLoc=0&LH_Complete=1","//div[@class='g-b bidsold']"))

Even though it goes off the page you can still copy it just fine :3

Enjoy,
Arujei

P.S. take a look at: http://www.youtube.com/watch?v=EXhmF9rjqP4
This is where I got the basic information on how to grab the data way back when I first found out about this.

Trackback from your site.

Arujei

I'm your happy go lucky Upbeat average John that's a Jack of all trades and a master of few too many. I'll go on about anime, games, other fandoms, development, technology, and other random stuff.

Comments (4)

  • Shawn

    |

    Did you take down your spreadsheet from Google Docs?

    Reply

  • silvian

    |

    Please fix the spreadsheet , it is not working as you see in d1 where the formula is , it is giving an error. I really want to use this . thanks

    Reply

    • Arujei

      |

      Looks like Ebay changed the page layout. I’ve change =average(ImportXML(URL,”//div[@class=’g-b bidsold’]”)) to =average(ImportXML(URL,”//span[@class=’g-b bidsold’]”)) to fix it.

      Reply

Leave a comment

Tweets