Do an eBay search.
- search text: iphone 3gs 32
- Preferences: Completed listings
- Preferences: Used
- show 200 results
Copy results to a local file
- create dedicated directory like /Users/exampleUser/ebaySoldPrice
- copy results tables only:
- select a word in the first listing
- from the right click menu, choose table2clipboard/select table
- scroll to end of page,
- shift click in last item to extend selection to include all items,
- right click and choose View selection source
- it takes a while for this window to populate
- Copy, paste and save text as "ebay_search_results.txt"
Clean up the results
- Open a terminal window and type the following commands (you may have to fix line breaks if you copy this text)
cd /Users/exampleUser/ebaySoldPrice/
cat ebay_search_results.txt | sed 's/~//g' |
sed 's/<table class="li" r="/~/g' |
tr "~" "n" | sed 's/ shipping.*$//' |
sed 's/([0-9]*).*class="vip">/1~/' |
grep Sold | sed 's/<[^$]*$/~/' |
sed 's/Free shipping/$0/' | sed 's/<[^$]*$/~/' |
sed 's/<.*$/~na/' | tr "~" "t"
>ebay_search_results_cleaned.txt
here's how that breaks down:
sed s'/\~//g'
                ### remove any tildes in ad titletr "~" "\n"
                ### replace tildes with newlinesed 's/<table class="li" r="/~/g'
                ### replace table starts with tildessed 's/ shipping.*$//'
                ### get rid of text after shippingsed 's/\([0-9]*\).*class\=\"vip\"\>/\1\~/' |
                ### keep the initial row number, deletes everything else until the titlegrep Sold
                ### limit to items that soldsed 's/\<[^$]*\$/~/' |
                ### delete text between title and pricesed 's/Free shipping/\$0/'
                ### give free a numerical valuesed 's/\<[^$]*\$/~/' |
                ### delete text between price and shipping pricesed 's/<.*$/~na/'
                ### if price doesn't have a dollar amount, delete text and give it an NA valuetr "~" "\t"
                ### replace tildes with tabs>ebay_search_results_cleaned.txt
                ### direct the output into a file
No comments:
Post a Comment