Files
dibs/README.md
2026-10-14 18:37:49 +02:00

30 KiB

dibs

dibs tells you the moment something you want is back in stock: at a price you're happy with, from a seller you trust. Then it gets you to the cart as fast as possible.

  • Works with Amazon out of the box: amazon.de, .co.uk, .fr, .it, .es, .nl and .com.
  • Alerts on your desktop, your phone (with the free ntfy app) or in Discord.
  • Other shops can be added with a small plugin file.
  • Runs on your own computer. No account to create, no server involved.

Contents


1. Download

Download the file for your operating system:

Computer File
Windows dibs-windows-amd64.exe
Mac (Apple Silicon: M1 and newer) dibs-darwin-arm64
Linux dibs-linux-amd64

These links always give you the newest version. Older versions and checksums are on the releases page.

Important

dibs also needs Google Chrome, Chromium or Microsoft Edge for some things (see section 6).
If none are installed, dibs downloads a copy of Chromium by itself the first time it needs one.

2. Set it up

dibs is a program you run from a terminal, the text window where you type commands.

Make a folder for dibs

  1. Make a new folder, for example dibs in your Documents.
  2. Move the file you downloaded into it and rename it to dibs (on Windows: dibs.exe).
  3. Download the example settings file into the same folder and name it dibs.toml.

Tip

If your browser shows the settings file as text instead of downloading it, right-click the link and choose Save Link As….

Open a terminal in that folder

Computer How
Windows Open the folder in Explorer, right-click an empty spot and choose Open in Terminal.
Mac Open Terminal (Applications → Utilities), type cd with a space, drag the folder onto the window and press Enter.
Linux Right-click in the folder and choose Open in Terminal.

Allow dibs to run

Mac and Linux: type these into the terminal, pressing Enter after each line:

chmod +x dibs
xattr -d com.apple.quarantine dibs

The second line is only for Macs. It tells macOS that you downloaded dibs on purpose; without it, macOS refuses to start a program that isn't from the App Store or a registered developer. If it answers "No such xattr", there was nothing to allow, and that's fine.

Windows: the first start may show a blue "Windows protected your PC" box. Click More info, then Run anyway.

Commands in this guide

Commands are written like this:

dibs --config dibs.toml

Type them as shown, but start them the way your operating system needs:

OS Type
Windows .\dibs.exe --config dibs.toml
Mac and Linux ./dibs --config dibs.toml

Say what you want

Open dibs.toml in a text editor: Notepad on Windows, TextEdit on a Mac. It's the example file, with an explanation next to every line. Fill in the things you want:

[[item]]
name      = "<name>"
shop      = "amazon"
urls      = ["https://www.amazon.de/dp/<id>"]
max_price = <price>
currency  = "EUR"

Copy the whole [[item]] block for each further thing you want.

Warning

Keep the file plain text when you save it.
TextEdit needs Format → Make Plain Text first.
In Notepad's save dialog, choose All files, or the file ends up as dibs.toml.txt and dibs won't find it.

Then check the file:

dibs config validate --config dibs.toml

It either says OK, or tells you the line and what's wrong with it.

3. Try it out

See what dibs reads from a product page:

dibs check https://www.amazon.de/dp/<id>

Then send yourself a test alert:

dibs notify test --config dibs.toml

4. Start watching

dibs --config dibs.toml

dibs shows a table with one row per product page, and a log underneath that says what it's doing.

Important

Leave the window open: dibs only watches while it's running.

Status Meaning
watching Not available yet, or not at your price, or not from your seller.
AVAILABLE It can be bought now, and it matches your price and seller.
blocked The shop showed a bot check. dibs waits a while and tries again.
needs-human The shop wants a person to solve a puzzle. See section 6.
error Something went wrong; the log says what.
paused You paused it.

When an item becomes available, its row flashes, the terminal beeps, and the alert goes out to every place you've set up. The alert has a link that puts the item in your cart: open it, check the cart, and buy.

After an alert, dibs stays quiet about that item for 30 minutes, unless the price drops further. cooldown in section 8 changes how long.

Keys

Key What it does
↑ ↓ Select a row
Enter Open the cart link of the selected item, or solve its bot check
o Open the product page in your browser
c Check the selected item now
p Pause or resume the selected item
Shift+P Pause or resume everything
l Scroll the log; press l again to go back
r Reload dibs.toml after you've changed it, without restarting
q Quit

How often dibs checks

Each page is checked every 3 minutes by default; interval changes that. Whatever the settings say, dibs never checks a page more than once a minute, and waits at least 10 seconds between any two requests to the same shop. That keeps dibs polite, and keeps shops from blocking you.

When a shop pushes back, dibs waits longer, up to 30 minutes, and goes back to normal once the shop lets it through again.

5. Alerts on your phone or in Discord

Desktop alerts are enabled by default. For alerts anywhere else, add webhooks under [notify] in dibs.toml. You can list several; dibs sends to all of them at once.

On your phone, with ntfy

ntfy is a free app for Android and iPhone.

  1. Install ntfy and tap + to subscribe to a topic. Make up a long, random topic name.

  2. Add it to dibs.toml:

    [notify]
    webhooks = [
      { url = "https://ntfy.sh/<your-topic>", format = "ntfy" },
    ]
    

Tapping an alert on your phone opens the cart link.

Warning

Anyone who knows the topic name can read your alerts, so don't pick an easy one.

In Discord

  1. In your Discord server, open Server Settings → Integrations → Webhooks → New Webhook, pick the channel and click Copy Webhook URL.

  2. Add it to dibs.toml:

    [notify]
    webhooks = [
      { url = "https://discord.com/api/webhooks/<id>/<token>", format = "discord" },
    ]
    

Warning

Keep the webhook address to yourself: anyone who has it can post to your channel.

Run dibs notify test --config dibs.toml to try them. For your own programs, there's also format = "json" (the payload format).

6. When a shop asks "are you human?"

Shops sometimes put a check in front of their pages to keep bots out. dibs gets past most of them by itself, by opening the page in an invisible Chrome and waiting for the check to pass.

Some checks need a person, such as a puzzle. The row then shows needs-human, you get a desktop notification, and dibs leaves that shop alone for a while. To get going again:

  1. Select the row and press Enter. A Chrome window opens on the page.
  2. Solve the check. The window closes by itself once the product page shows up, and dibs carries on.

Running dibs without the table (see Running in the background)? Use this instead, with the product page's address:

dibs solve https://www.amazon.de/dp/<id>

Note

dibs never uses captcha-solving services.

7. Letting dibs fill your cart (optional)

Normally the alert carries a link, and the item goes into your cart when you open it. dibs can also sign in to your shop account and put the item in your cart itself, while it's sending you the alert. Then you only need to open the cart and pay.

Caution

Shops don't like automated sign-ins!
Amazon in particular may lock your account, or ask you to verify it, after a sign-in it finds suspicious.
dibs signs in as rarely as it can, and asks you to accept this risk before it signs in for you the first time.
If you'd rather not take it, don't use this mode. The normal cart link works without signing in.

Turn it on

Add this to dibs.toml:

[accounts.amazon]
cart_mode = "session"

Sign in

The safest way is to sign in yourself, in a Chrome window that dibs opens:

dibs login amazon --browser --config dibs.toml

Sign in as usual, then close the window. dibs keeps the sign-in for every Amazon site in your dibs.toml, with one window per site. When the sign-in runs out, alerts fall back to the normal cart link, and the log tells you to sign in again.

Letting dibs sign in by itself

If you'd like dibs to sign in again on its own when a sign-in runs out, it needs your email address and password:

[accounts.amazon]
cart_mode    = "session"
username     = "<email>"
password_env = "DIBS_AMAZON_PASS"
twofa        = true                 # if Amazon asks you for a code when you sign in

Your password never goes into dibs.toml. password_env names a variable you set in the terminal before starting dibs, in the same window:

Computer Type
Windows $env:DIBS_AMAZON_PASS = "<password>"
Mac and Linux export DIBS_AMAZON_PASS='<password>'

When Amazon asks for a code, dibs shows a box where you type it in. If Amazon wants something dibs can't do, such as a puzzle or an approval on your phone, sign in with --browser instead.

What happens when an item comes back

  1. You get an alert straight away: "In stock: …, adding to cart".
    It links to the product page, not the cart link, so nothing gets added twice.
  2. dibs adds the item to your cart, unless it's there already.
    This takes about half a minute, because dibs waits between requests to the shop.
  3. You get a second alert: "In cart: …, finish checkout", with a link to your cart.
    If adding didn't work, it says why and carries the normal cart link instead.

Signing out

dibs logout amazon --config dibs.toml

This deletes the sign-in dibs keeps. dibs stores it encrypted, with the key in your computer's password store: Keychain on a Mac, Credential Manager on Windows, the desktop's keyring on Linux. Without a password store, dibs warns you and stores it in a file only your user account can read.

8. All settings

dibs.toml is a TOML file. dibs rejects settings it doesn't know, so a typo can't go unnoticed. Anything marked optional can be left out.

[[item]], one per thing you want

Setting Optional Meaning
name No Any name, shown in alerts. Must be different for every item.
shop No The plugin that reads the pages: amazon, or one of yours.
urls No The product pages, as a list: ["https://…", "https://…"].
max_price Yes Only alert at this price or below.
currency Yes The currency of max_price, such as EUR, GBP or USD.
Pages in another currency are converted at the day's exchange rate from the European Central Bank.
fx_margin Yes Added to converted prices before comparing, to cover card and exchange fees: 0.05 means 5%.
seller Yes first_party includes only offers sold by the shop itself.
fulfilled (the default) includes other sellers, if the shop ships.
any includes every seller available.
interval Yes How often to check each page, such as "90s", "3m" or "1h".
Default "3m", at least "60s".

[notify]

Setting Meaning
desktop true (the default) or false: notifications on this computer.
webhooks Optional. Where else to send alerts, see section 5.
cooldown How long to stay quiet about an item after an alert, unless its price drops. Default "30m", at most "168h" (a week).

[accounts.<shop>], such as [accounts.amazon]

Setting Meaning
cart_mode "deeplink" (the default): alerts carry a cart link. "session": dibs signs in and fills the cart, see section 7.
username Your email address, if dibs should sign in by itself.
password_env The name of the variable holding your password. dibs refuses to start if it's not set.
twofa true if signing in asks you for a code.
login_url, cart_url Optional. A different sign-in or cart page than the plugin's own.

[plugins]

Your own plugins, as <name> = "<file>.lua". The path is relative to dibs.toml. See Adding a shop.

[sandbox]

Limits for plugins. You won't need to touch these.

Setting Default Meaning
timeout "2s" How long a plugin may take to read a page.
session_timeout "5m" How long signing in or adding to the cart may take, including typing a code.
memory_mb 64 Roughly how much memory one plugin call may use.
call_stack 200 How deep a plugin's functions may call each other.

Without --config

If you'd rather type just dibs, put dibs.toml where dibs looks for it by default:

Computer Place
Windows %AppData%\dibs\dibs.toml (type %AppData% into Explorer's address bar)
Mac ~/Library/Application Support/dibs/dibs.toml (Finder → Go → Go to Folder…)
Linux ~/.config/dibs/dibs.toml

dibs keeps its other files in the same folder:

File Holds
state.json When each page was last checked, and which alerts went out.
cookies.json The shops' cookies.
sessions/ Your sign-ins, encrypted.

Running in the background

dibs --headless --config dibs.toml

This runs without the table and writes the log to the terminal, one line per event. That's handy on a computer you leave running, or as a service. Codes for signing in are then asked in the terminal, and bot checks are solved with dibs solve.

Adding a shop

A shop is added with a plugin: a small text file in the Lua language that tells dibs where to find the title, the price and the "add to cart" button on the shop's pages. The Amazon plugin built into dibs is written the same way, and is the most complete example: internal/plugin/builtin/amazon.lua.

A first plugin

examples/exampleshop.lua is a complete plugin for a made-up shop:

return {
	name = "exampleshop",

	matches = function(url)
		return url:match("^https://www%.example%-shop%.com/") ~= nil
	end,

	parse = function(doc, url)
		local price, currency = parse_price(doc:text(".product-price"))

		local sold_out = contains_any(doc:text(".stock-status"), { "sold out", "ausverkauft", "épuisé" })

		return {
			title     = doc:text("h1"),
			available = doc:exists("button.add-to-cart") and not sold_out,
			price     = price,
			currency  = currency or "EUR",
			seller    = "first_party",
		}
	end,
}

To adapt it:

  1. Copy it next to your dibs.toml, and give it the shop's name, in the file name and in name.

  2. Change matches to the shop's address. In these patterns, %. stands for a dot and %- for a dash.

  3. Find the parts of a product page: in Chrome, right-click the price and choose Inspect. The highlighted line shows the element, such as <span class="product-price">; its selector is .product-price. Do the same for the title, the button and the stock text.

  4. List the plugin in dibs.toml, and use its name as the items' shop:

    [plugins]
    exampleshop = "exampleshop.lua"
    
  5. Try it on a real page:

    dibs check https://www.example-shop.com/p/<id> --config dibs.toml
    

A plugin of yours with the same name as a built-in one replaces it.

What a plugin can do

The plugin table

A plugin returns a table with these entries. Only parse is required.

Entry Meaning
name The plugin's name.
matches(url) Returns true for URLs the plugin reads. Lets dibs check pick the plugin.
normalize(url) Returns the URL in one standard form, so the same product isn't watched twice.
parse(doc, url) Reads a page and returns what it found (see below).
cart_link(url, id) Returns a link that puts the item in the cart. id is the id from parse.
login(ctx, account) Signs in, for session mode.
add_to_cart(ctx, url) Puts the item in the cart, for session mode.
session_warning Text shown once before the first sign-in, such as a warning about account locks.

parse returns a table with:

Field Meaning
available Required. true if the item can be bought now.
title The product's name.
price A number, such as 129.99.
currency A code such as "EUR".
seller "first_party", "fulfilled", "third_party" or "unknown" (the default).
id The shop's product number, passed to cart_link.
Reading the page

doc is the page. Each of its methods takes a CSS selector and works on the first element that matches; without a selector, on the element itself:

Method Returns
doc:text(sel) The visible text, with spaces tidied up, or nil if there's none.
doc:attr(sel, name) The value of an attribute, such as doc:attr("a.buy", "href"), or nil.
doc:exists(sel) Whether anything matches.
doc:count(sel) How many elements match.
doc:html(sel) The element's HTML, or nil.
doc:all(sel) A list of every matching element, each with the same methods.

Helpers:

Helper Does
parse_price(text) Reads a price such as "1.299,99 €", "£1,299.99" or "1 299,99 €". Returns the number and the currency code (or nil), or nil if the text has no price.
contains_any(text, {…}) Whether the text contains any of the phrases, ignoring upper and lower case.
regex_match(text, pattern) Matches a Go regular expression. Returns a list of the captured groups (or of the whole match), or nil.
log(…) Writes a line to dibs's log.

Plugins run in a sandbox: they can't read or write files, run programs, or reach the network other than through ctx. Each call is stopped after a time limit and a rough memory limit (see [sandbox] in section 8).

Session mode in a plugin

login(ctx, account) and add_to_cart(ctx, url) get a ctx to talk to the shop with the account's cookies. Like checks, requests through ctx wait at least 10 seconds after the last request to the same shop.

Call Does
ctx:get(url, opts) Loads a page.
ctx:post(url, opts) Sends a form. opts.form is a table of fields; opts.body and opts.content_type send anything else.
ctx:click(url, sel) Opens the page in an invisible Chrome, clicks the element and returns the page the click leads to. For shops that only accept what their own page scripts send, as Amazon does with "add to cart".
ctx:prompt(label, secret) Asks the user, such as for a code. secret = true hides the typing.
ctx:cookies(url) The account's cookies for the URL, as a table of names and values.
ctx.account username, site, twofa, login_url and cart_url, without the password.

opts may also have referer (the page the request comes from) and headers (a table). Every call returns the page as a table with status, url (after redirects), verdict ("ok", "not-found", "challenge", "blocked", "http-error" or "needs-human"), body, headers (with lower-case names) and doc.

login gets account with the password as well, and signs in to account.site. When it can't, it stops with error("…"), and the message shows up in the log.

add_to_cart must not add the item if it's in the cart already. It returns true and the cart page's URL once the item is in the cart, or false if it finds the session signed out, in which case dibs signs in again.

For developers

dibs is written in Go and needs Go 1.26 or newer. It builds without cgo into a single file.

make build      # builds ./dibs for this computer
make test       # runs the tests; GOTESTFLAGS=-short skips the ones that start Chrome
make lint       # runs golangci-lint at a pinned version
make release    # builds the release binaries into dist/, with SHA256SUMS

make release TARGETS="linux/arm64 darwin/amd64" builds for other systems, such as Intel Macs.

The Amazon plugin's tests also run on real product pages, which aren't kept in the repository because they change and may contain personal data. dibs fixtures downloads the pages listed in testdata/amazon/cases.toml; without them, those tests are skipped.

License

GNU Affero General Public License v3.0.