This python script scrapes information from eBay search query results for items for sale and converts them into a JSON file or, if specified, a CSV file. The script provides information on the product's name, price, status, shipping cost, whether the product has free returns, and the number of items sold.
The script only requires one argument, search_term
, which should be entertered into your Python terminal, as shown below.
$ python3 ebay-dl.py search_term
search_term
is the product you intend to search for. For example, if you want to scrape informaton on brooms from eBay, simply write "brooms" in the terminal.
$ python3 ebay-dl.py brooms
Be sure to include quotation marks if the search_term
is more than two words.
$ python3 ebay-dl.py 'fanny pack'
If you want to scrape eBay results into a CSV file rather than a JSON file, use the --csv
flag. After you enter your search_term
in the terminal, write --csv=True
.
$ python3 ebay-dl.py 'fanny pack' --csv=True
By default, the script scrapes the first ten pages of results from eBay. The number of pages scraped can be set manually with the--num_pages
flag. After the search_term
, write --num_pages=n
, with n being number of pages. For example, if you wanted to scrape only the first seven pages you would write in the terminal:
$ python3 ebay-dl.py 'fanny pack' --num_pages=7