Skip to content

Collecting product information from Dutch supermarkets: Albert Heijn and Jumbo using the Mobile API

License

Notifications You must be signed in to change notification settings

everstessa1/SupermarktConnector

 
 

Repository files navigation

SupermarketConnector

Publish

Collecting product information from Dutch supermarkets: Albert Heijn and Jumbo

Getting Started

Install the Pip package

pip install supermarktconnector

Sample

Import the jumbo connector and search for a product

from supermarktconnector.jumbo import JumboConnector
connector = JumboConnector()
connector.search_products(query='Smint', size=1, page=0)
{
  "products": {
    "data": [
      {
        "id": "70942PAK",
        "title": "Smint Peppermint Sugarfree 100 Stuks 2 x 35g",
        "quantityOptions": [
          {
            "defaultAmount": 1,
            "minimumAmount": 1,
            "amountStep": 1,
            "unit": "pieces",
            "maximumAmount": 99
          }
        ],
        "prices": {
          "price": {
            "currency": "EUR",
            "amount": 365
          },
          "unitPrice": {
            "unit": "kg",
            "price": {
              "currency": "EUR",
              "amount": 5214
            }
          }
        },
        "available": true,
        "productType": "Product",
        "quantity": "2 x 35 g",
        "imageInfo": {
          "primaryView": [
            {
              "url": "https://ish-images-static.prod.cloud.jumbo.com/product_images/240420200540_70942PAK-1_360x360.png",
              "height": 360,
              "width": 360
            }
          ]
        }
      }
    ]
  }
}

You can also get the different product-categories:

from supermarktconnector.ah import AHConnector
connector = AHConnector()
connector.get_categories()
[
  {
    "id": 6401,
    "name": "Aardappel, groente, fruit",
    "images": [
      {
        "height": 400,
        "width": 600,
        "url": "https://static.ahold.com//cmgtcontent/media//002304400/000/002304468_001_groenten-fruit.png"
      }
    ],
    "nix18": false
  }
]

Deprecated

X-Digest (Albert Heijn)

The Albert Heijn used a special X-Digest for verifying that the app data traffic was coming from the backend, in the new versions this has been removed.

This X-Digest is an hashed value that uses SHA1 to check if the request is valid and made by the original android app. The logic behind this hash is:

X_DIGEST = URL + PARAMETERS + USERNAME + POST_BODY (Max 1000 bytes) + SECRET_PASSWORD

Price differences (Jumbo)

In the past all the the jumbo stores where divided over 5 different categories, with each category a different price for some of the products. The token used for store identification is no longer working in the new versions, It might be handled on the backend.

I created an interactive map which sorts all the stores by category.

Jumbo prices

About

Collecting product information from Dutch supermarkets: Albert Heijn and Jumbo using the Mobile API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%