I am looking for a way to get a product's google shopping page based on it's GTIN code.
For example, if I have the GTIN 03661238046573 I want to be able to go to the page : https://www.google.com/shopping/product/1778678479788252976/online
Is there a way to get this code (here 1778678479788252976)?
To get the product ID you can query the next link: https://www.google.com/search?q=iphone+12&oq=iphone+12&uule={google_encrypted_location}&hl=en&gl=us&tbm=shop&sourceid=chrome&ie=UTF-8
google_encrypted_location: e.g
w+CAIQICIaQXVzdGluLFRleGFzLFVuaXRlZCBTdGF0ZXM(Austin,Texas,United States)More on how to get the uule for a specific location: https://blog.linkody.com/seo-local/uule-2
By expecting the page source you can find the product ID:
After you get your ID, you can use it to query the link you posted: https://www.google.com/shopping/product/ID/online
Alternatively, you could use a third party solution like SerpApi. It's a paid API with a free trial.
Example python code (available in other libraries also), to get the products and their IDs:
Example JSON output:
Then make another request with the acquired
product_idExample JSON output:
Check out the Google Shopping API, and Google Product API documentations for more details.
Disclaimer: I work at SerpApi.