I am trying to run a Beautiful Soup demo to scrape prices from Ebay and the prices are all in USD but for some reason when I scrape the prices it automatically converts it into NT$. Not sure what is going on. I tried going to the UK site and it prints the correct currency. I tried different links that lead to the same site but with US Ebay IDs but still no difference.
page = requests.get('https://www.ebay.com/sch/i.html?_from=R40&_nkw=dodge+viper&_sacat=0&_sop=20')
soup = bs(page.content)
prices = soup.find_all('span', class_='s-item__price')
2
Answers
I figured it out. Had something to do with Google Colab and the way it grabs the info from Ebay. I ran the code on Jupyter Notebook on my local machine and it worked fine.
BeautifulSoup has nothing to do with converting price as it only extracts price from HTML when you extract certain bits of HTML with CSS selectors.
You can change the price only by changing the eBay domain to some other one, you can also get prices from several domains at once:
Check full code in the online IDE.
Example output:
As an alternative, you can use Ebay Organic Results API from SerpApi. It’s a paid API with a free plan that handles blocks and parsing on their backend.
Example code:
Output:
There’s a 13 ways to scrape any public data from any website blog post if you want to know more about website scraping.