codeinthehole / food-scraper

Git scraper for UK supermarket prices
10 stars 1 forks source link

Use Ocado products API for item price #50

Open leonghui opened 3 months ago

leonghui commented 3 months ago

Hi there,

Interesting repo! Instead of scraping with Beautiful Soup, it might be simpler to consume JSON directly using a query like this: https://www.ocado.com/webshop/products?skus=<id1>,<id2>,...

which returns:

{
  "23476011": {
    ..
    "product": {
      "outOfStock": false,
      "name": "New York Bakery Co. Plain Bagels",
      "price": {
        "currentPrice": "&pound;1.90"
codeinthehole commented 3 months ago

Good tip. I'll try that out.