Skip to content

About

Log your Nespresso pod's caffeine to Apple Health with Shortcuts ☕️

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

capsule-caffeine: caffeine in every Nespresso pod, logged to Apple Health

capsule-caffeine

CI data build latest data release Shortcut on iCloud Shortcut on RoutineHub

The caffeine content of Nespresso pods, scraped weekly from nespresso.com and published as JSON, with an Apple Shortcut that logs it to Health.

Shortcut

Nespresso Log (also on RoutineHub) logs a pod's caffeine to the Health app. Pick the machine, range and pod, say how many pods, and it logs the total with a notification showing the pod. When you add it, it asks for a market: tw (Taiwan), sg (Singapore) or merged (both, experimental). It reads the published data, so it picks up new pods without updating. Run it with a date as input to log a pod after the fact.

Pods that Nespresso publishes no caffeine figure for are not logged. If the data ever moves to a new format, the Shortcut asks you to update it rather than logging wrong numbers.

The Shortcut is generated from shortcut.py, and each release attaches an unsigned build. Shortcuts only imports signed files, and signing needs a Mac logged into iCloud, so to build your own:

scripts/sign-shortcut.sh            # the latest release's build, signed as "Nespresso Log.shortcut"
scripts/sign-shortcut.sh --local    # or build from this checkout
scripts/sign-shortcut.sh --upload   # also attach the signed file to the release

The original Shortcuts (single pod, multiple pods) read data pinned to the v1.1 and v1.0 tags. They keep working, but their data is no longer updated.

Running the scraper

Requires uv.

uv run capsule-caffeine -v scrape          # all markets and lines, into dist/
uv run capsule-caffeine scrape --locale tw --line Vertuo
uv run capsule-caffeine diff old-dist/ dist/   # release notes; exit 1 when changed
uv run capsule-caffeine site dist/ -o site/    # static site for GitHub Pages

A run writes one dist/<market>/capsules.json per market, keeping that market's own ranges. The defaults are tw and sg, the English-language markets that publish caffeine content. au, hk, my and nz run the same site but give no caffeine values; uk, us, ca and ie run a different site. With several markets it also writes dist/merged/capsules.json. That file is experimental: pods are matched by name across markets, and ranges are renamed through ranges.json. New range slugs show up as warnings and need adding there.

Every file follows schema 2:

{
  "schema": 2,
  "generated_at": "2026-10-24T12:00:00Z",
  "scraper": "2.0.0",
  "source": { "site": "nespresso.com", "language": "en", "locales": ["tw"] },
  "lines": {
    "Vertuo": {
      "Espresso": {
        "Double Espresso Dolce": {
          "id": "7034.80",
          "caffeine_mg": 133,
          "image_url": "https://www.nespresso.com/ecom/medias/…/320.png",
          "page_url": "https://www.nespresso.com/tw/en/order/capsules/vertuo/…"
        }
      }
    }
  }
}

caffeine_mg is null when the product page gives no value. Where a page gives a range (sg does, for example "120 – 300mg per cup"), caffeine_range_mg holds [low, high] and caffeine_mg is its midpoint. In the merged file, tw's single figure is preferred. A file that fails the checks (schema, a minimum number of pods per line, at most half missing caffeine) makes the run exit with an error.

site copies each capsules.json next to a plain table of names and caffeine figures linking to the Nespresso product pages, with no images or product descriptions.

Scraped data is a build output and is not committed to this repository. Tests run offline against hand-made pages: uv run pytest.

See this Gist for a sample of the JSON found on the Nespresso site if you're interested in extending the scraper.

Data

A weekly workflow scrapes with the latest code release and, when the data has changed, publishes it to GitHub Pages:

  • https://atdr.github.io/capsule-caffeine/<market>/capsules.json (tw, sg, merged) always holds the latest data, with a readable table at https://atdr.github.io/capsule-caffeine/<market>/.
  • Each change is also kept as a data-YYYY-MM-DD release with the files attached as <market>-capsules.json, for anyone who wants to pin a version. These are never marked as the latest release.

A new code release rebuilds the site. Pages has to be set to deploy from GitHub Actions once: gh api -X POST repos/atdr/capsule-caffeine/pages -f build_type=workflow.

Releases

The scraper is versioned by release-please from conventional commit messages, which also write CHANGELOG.md. Don't edit either by hand. Data is not versioned with the code.

Thanks

To everyone who kept this going in their forks: DEEJCUK for Vertuo support and a sturdier standalone scraper, which inspired this one; edspc and yuejunfeng0909 for data refreshes and Singapore support; and wiebecommajonas and indiamai for their contributions here. The Shortcut's parameter check uses action definitions extracted by shortcutkit (MIT).

License

The code in this repository (the scraper) is released under the MIT License.

Data produced by the scraper is not covered by that license. It holds product information scraped from the Nespresso website, which this project does not own and cannot license. Nespresso is a trademark of Société des Produits Nestlé S.A.; this project is not affiliated with or endorsed by Nestlé.

About

Log your Nespresso pod's caffeine to Apple Health with Shortcuts ☕️

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Contributors

Languages