I'm trying to scrape Google Shopping using Scrapy.
start_url is https://www.google.com/search?q={}&tbm=shop
I'm injecting the keyphrases into the above URL, for example, "cement+50+kg".
But I want to run the search in a different country - for example, look up cement prices in the United States. How do I achieve this?
I was trying this out manually to see if the URL changes:
- Changed region in Advanced Search - the search query param was added, but search results did not change accordingly.
- Changed search country in Search Setting - the results were from the country, but I couldn't figure out the query parameter in the URL.
Also, I have only done this at a very small scale, so any heads up regarding blocking, code change, etc issues I might face with Google Shopping will be much appreciated.
Are there any major roadblocks in using Scrapy? Shall I use Selenium, instead?
Google uses
uuleparameter to pass location data. It is used to encode a place or an exact location (with latitude and longitude) into a value used in a cookie, an url or an http header.United States == w+CAIQICINVW5pdGVkIFN0YXRlcw
You could read more about it here: https://valentin.app/uule.html
There is also a third party solution like SerpApi. It's a paid API with a free trial. We handle proxies, solve captchas, and parse all rich structured data for you.
Example python code (available in other libraries also):
Example JSON output:
Check out the documentation for more details.
Disclaimer: I work at SerpApi.