Skip to content

Instantly share code, notes, and snippets.

@laacz
Created December 18, 2020 18:53
Show Gist options
  • Save laacz/c575bb0b66e329922767346b1d0bc2cb to your computer and use it in GitHub Desktop.
Save laacz/c575bb0b66e329922767346b1d0bc2cb to your computer and use it in GitHub Desktop.
# Check logitech online store (EMEA) stock against availability of certain device
# Edit to include your logitoken cookie (see variable TOKEN). Check cookies in your browser, when opening logitech.com.
#
# When item is not in stock, script outputs nothing
# When item is in stock, script outputs its analytics name (one line)
TOKEN='...'
curl -s 'https://www.logitech.com/content/logitech-com/emea/live/en_eu/products/keyboards/mx-keys-wireless-keyboard.inventory.json?includeInventory=true' \
-H 'authority: www.logitech.com' \
-H 'cache-control: max-age=0' \
-H 'upgrade-insecure-requests: 1' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36' \
-H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
-H 'sec-fetch-site: none' \
-H 'sec-fetch-mode: navigate' \
-H 'sec-fetch-user: ?1' \
-H 'sec-fetch-dest: document' \
-H 'accept-language: en,lv;q=0.9,en-GB;q=0.8' \
-H 'cookie: logitkn='$TOKEN \
--compressed | jq -c '.skus[] | select(.inStock == false and .variantAnalytics == "platform:keyboard-with-palm-rest;language:us-international-qwerty")'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment