Skip to content

The Chrome extension

The AutoMiner Capture extension tells your AutoMiner server what you play in Chrome. It watches two sites, YouTube and the Spotify web player, and sends a short event to the server when you start, pause, seek and stop. The server records the watch (it counts on Today) and, when the watch ends, fetches and mines it.

The extension sends nothing until you give it your server’s address. When the server is down, it keeps the events in the browser and sends them later, in order.

On an Android phone, YouTube watches are reported by a patched YouTube app instead; see YouTube on an Android phone.

Site What counts What does not
YouTube Video pages on https://www.youtube.com/watch?v=…, including videos played from a playlist Shorts, m.youtube.com, YouTube Music, and YouTube players embedded in other sites
Spotify The Spotify web player on https://open.spotify.com: podcast episodes and music tracks in the now-playing bar The Spotify desktop and phone apps (for podcasts, AutoMiner’s Spotify tracker reads those from your Spotify account; see Adding Spotify and podcasts)

Each event carries:

  • the site (youtube or spotify) and the device name (see Settings);
  • a random session id, new for each viewing;
  • what is playing: the YouTube video id, title and length, or the Spotify episode or track id, its title and the show’s name;
  • the kind of event, the time, and the position in the video.

Nothing else leaves the browser: no account, no cookies, no other pages.

On YouTube:

  • Session start as soon as a video page opens, or when playback starts again after a session ended.
  • Position every 10 seconds while the video plays.
  • Pause, resume and seek as they happen.
  • Session end when the video ends, when you open another video, leave the video page or close the tab, and after 90 seconds with nothing sent (for example, when the video stays paused for more than 90 seconds). Pressing play again starts a new session.

On the Spotify web player:

  • The extension looks at the player every 5 seconds. A session starts once the position moves forward.
  • Position every 5 seconds while it plays; pause when the position stops moving; seek when it jumps.
  • Session end when the episode or track changes, when the player no longer shows one, when you close the tab, and after 90 seconds without a position (paused for more than 90 seconds).

The session end is what makes the server fetch and mine the video or episode. Opening a YouTube video page is enough to report it, even if you never press play. If you open many videos you don’t watch, set YouTube to Only what I watched (see Adding YouTube): such a video is still fetched (and transcribed, if it has no subtitles), but it makes no cards.

You load the extension unpacked, from a folder on the computer where Chrome runs:

  • Windows installer: the installer copies it to %LOCALAPPDATA%\Programs\AutoMiner\extension. See Installing on Windows.
  • Any other setup: the extension folder of the AutoMiner repository. If your server is another machine (a Raspberry Pi, a NAS), put a copy of the repository on your desktop computer too, with git clone or as a ZIP download, and use its extension folder.

The right folder is the one that contains manifest.json.

  1. Open chrome://extensions.
  2. Switch on Developer mode (top right).
  3. Click Load unpacked and choose the extension folder.
  4. A card named AutoMiner Capture appears. Click the puzzle-piece icon in Chrome’s toolbar and pin AutoMiner Capture, so its icon and badge stay visible.

Chrome may remind you at startup that a developer-mode extension is on. You can dismiss it.

Settings and waiting events are stored per Chrome profile. If you use several Chrome profiles, load and set up the extension in each one. Chrome does not run extensions in Incognito windows unless you switch on Allow in Incognito in the extension’s Details.

  1. Find your server’s address. The setup page’s What you watch card shows this AutoMiner’s URL, with a Copy button. It is the address you opened AutoMiner with, such as http://192.168.1.20:8801. If you opened AutoMiner on the server itself as http://127.0.0.1:8801 and Chrome runs on another computer, use the address that computer can reach instead (the LAN or Tailscale address).
  2. Click the AutoMiner Capture icon. The popup opens with a blue note: “Set the AutoMiner core URL below to start capturing. Nothing is sent until you do.”
  3. Paste the address into Core URL: just the scheme, host and port, such as http://<server>:8801, with no path after it.
  4. Click Save settings. Chrome asks whether to let AutoMiner Capture access that address. Choose Allow.
  5. The popup says saved: http://<server>:8801.
  6. Click Test core connection. It should say core reachable at http://<server>:8801/healthz (v<version>).

Then make sure the server has the platform installed. A fresh AutoMiner has no platforms installed, and the server throws away events for a platform that is not installed, while still answering the extension that the event arrived. Install YouTube in Settings › Sources › Platforms › Add; see Adding YouTube. For the Spotify web player, install Spotify the same way; see Adding Spotify and podcasts.

Chrome does not update an unpacked extension by itself. After you update the folder (a new git pull, or a newer Windows installer), open chrome://extensions and click the reload arrow on the AutoMiner Capture card. Your settings and any waiting events are kept. Removing the extension deletes both.

The bottom half of the popup holds the settings. They take effect when you click Save settings.

Field Default What it does
Core URL empty: nothing is sent Your AutoMiner server’s address. It must start with http:// or https://, must not contain a user name or password, and must be the base address only, with no path, ? query or # fragment.
QA mode (mark events as verification data) off For testing AutoMiner. Watches sent in QA mode are marked as verification data and left out of your watch statistics. While it is on, the popup shows “QA mode ON: events are marked as verification data”. Leave it off for real use.
Device name (shown on Today; blank = pc-chrome) pc-chrome The name this browser’s watches carry on Today, for example in the By device card. Use 1 to 64 letters, digits, spaces, ., _ or -, starting with a letter or digit. phone-spotify, stremio and api are reserved for the server’s own trackers.
Preview token (only if the core requires one) empty Needed only when your server has a preview token set (AUTOMINER_PREVIEW_TOKEN). The server then refuses every API request that does not carry it. Leave it empty otherwise.

Save settings checks the address and the device name first. If one is wrong, nothing is saved and the popup says why:

Message Fix
not saved: not a valid URL Type the whole address, including http://.
not saved: must start with http:// or https:// Use http:// or https://.
not saved: must not contain credentials Remove user:password@ from the address.
not saved: base URL only, no path, query or fragment Remove everything after the port, such as /settings.
not saved: device name: 1-64 letters, digits, space, . _ - (starting with a letter or digit) Shorten the name or remove other characters.
not saved: device name: "<name>" is reserved for the server's adapters Pick another name.
not saved: host permission for <address> was denied You chose Deny in Chrome’s prompt. Click Save settings again and choose Allow.

The extension always has access to www.youtube.com and open.spotify.com: it needs that to read the player. It has no access to your server until you allow it. Save settings asks Chrome for access to that one address. When you later change the Core URL, the extension asks for the new address and gives up the old one.

If the access is removed afterwards (for example in the extension’s Details › Site access), the popup shows: “Chrome has not granted access to <address>. Press Save settings to grant it; nothing is sent until then.” New events are then counted as Not sent (no core URL) and are not kept. Click Save settings and choose Allow.

The dot and text at the top describe the last event.

Dot Text Meaning
gray no events yet Nothing played since the extension was installed.
gray core URL not set: nothing is being sent No Core URL, or Chrome has no access to it. Events are dropped, not kept.
green delivered to core The server took the event.
orange kept to re-send The server could not be reached or answered with an error. The event waits in the browser and is sent again.
orange relay up, core unreachable Only when the Core URL is a relay that answers it kept the event for later. The relay agent in extension/agent/agent.py never does: when the server is down, the extension keeps the event itself (kept to re-send, with Last error relay could not reach the core: …).
red core unreachable The saved Core URL could not be read. The popup also says stored core URL is invalid: …. Enter the address again and click Save settings.
red core rejected event The server refused this one event as malformed. It is set aside (see below).
dark orange core refused this client — events kept The server is not accepting events from this extension. See When the server refuses this client.
dark red could not be saved — this event is gone Chrome would not store the event (for example, its storage is full), so it was lost.
orange ring idle — nothing sent for <time> ago Nothing was sent for more than 5 minutes. This is normal when you are not watching anything.

Under it:

  • Last event: the kind of the last event, such as position or session.end.
  • Source: youtube or spotify.
  • Title: what was playing.
  • At: the time of the last event and how long ago it was.
  • Last error (below the counters): the most recent problem, in full, when there is one. For example kept for retry (3 waiting): core unreachable at http://<server>:8801/v1/events: TypeError: Failed to fetch.
Counter Counts
Delivered to core Events the server took.
Queued by relay (core down) Events a relay said it kept for later. Stays 0 when the Core URL is the server or the relay agent in extension/agent/, which keeps nothing.
Rejected by core Events the server refused as malformed (HTTP 400, 404 or 422).
Sends that did not land Events that could not be sent when they happened and were kept to try again.
Not sent (no core URL) Events dropped because no Core URL was saved or Chrome had no access to it.
Waiting to re-send Events in the browser waiting to be sent.
Set aside (refused, or by you) Events moved out of the way. Shown only when not 0.
Dropped (queue full) Oldest waiting events dropped because more than 2,000 were waiting. Shown only when not 0.
Dropped (set-aside list full) Oldest set-aside events dropped because more than 200 were set aside. Shown only when not 0.
Lost (could not be saved) Events Chrome would not store. Shown only when not 0.

The badge on the extension’s icon shows how many events were delivered (up to 999), colored by the last result: green when delivered, orange when kept or when the server refuses the client, red when it rejected an event. It shows ! when no Core URL is set.

  • Test core connection asks the server’s /healthz page, with an 8-second limit. It answers core reachable at … with the server’s version, core at … responded HTTP <code>, core unreachable at …: <error>, or no core URL set: enter one below and Save settings.
  • Put set-aside events back in the queue and Set the stuck event aside appear while events are waiting or set aside. See the next section.

Every event is saved in the browser before it is sent. Events go out one at a time, in the order they happened. When a send fails, the extension waits 15 seconds before trying again, then doubles the wait up to 5 minutes. It also checks the queue once a minute. Waiting events survive a Chrome restart.

What the server does What the extension does
Can’t be reached, times out after 8 seconds, or answers with another error (such as 500, 503, or 401 for a wrong preview token) Keeps the event and tries again later.
Answers 400, 404 or 422 for the event itself Sets the event aside, so the events behind it can go. Counted in Rejected by core.
Refuses this client (see below) Keeps every event and tries again every 30 minutes.

Up to 2,000 events can wait. Beyond that the oldest are dropped. Up to 200 events can be set aside.

Two buttons help when the queue is stuck:

  • Put set-aside events back in the queue moves every set-aside event back to the front of the queue. Use it after fixing whatever made the server refuse them. The popup says put <n> event(s) back at the front of the queue.
  • Set the stuck event aside moves the first waiting event to the set-aside list, so the ones behind it can be sent. The popup says set aside; the queue behind it can move now.

A server can be set to accept events only from client programs its owner has approved (“producers”). Out of the box it accepts every client, so a new install needs nothing here. How the policy works is in Producer admission.

When the server refuses the extension itself (not one event), the popup shows an orange box: “The core is not accepting events from this client.”, then the server’s own explanation, what has to change, and a reason code such as producer_identity_unknown. It also says how many events are kept, for example “3 event(s) are kept and will be sent once the core accepts this client.”

Nothing is lost. The extension keeps every event and asks again every 30 minutes. The box clears at the first delivered event.

What to do depends on the reason code:

Reason What to do
producer_identity_unknown, producer_identity_revoked, producer_identity_expired On the server, approve the extension: autominer producers approve extension --operator <your name> --note "<why>". autominer producers list shows who is being refused and why.
producer_contract_missing, producer_contract_unsupported, producer_build_missing The extension is too old for the server. Update the folder and reload the extension (see Updating it).

The extension sends events again in their original order once it is accepted, and the server ignores any it already has.

  1. Open the popup and click Test core connection. You should see core reachable at ….
  2. Play a YouTube video for at least 10 seconds. The popup shows delivered to core, Source youtube and the video’s title, and Delivered to core goes up.
  3. Open (or reload) AutoMiner’s Today page. The video appears with your device name.
  4. Close the video’s tab. If YouTube is installed and set to mine, the server starts fetching it. See Adding YouTube for what follows.

The popup says core URL not set: nothing is being sent. Enter the Core URL and click Save settings. If a URL is already there, Chrome has no access to it: click Save settings and choose Allow.

The status is kept to re-send and Last error says core unreachable. The browser can’t reach the server. Open the Core URL in a Chrome tab. If that fails too, the server is down or the address is wrong. Check that AutoMiner is running, that the port is right, and, away from home, that Tailscale is connected. The events are kept and go out once the server answers.

Last error says core returned HTTP 401: unauthorized. The server has a preview token set. Paste it into Preview token and click Save settings.

The popup shows green delivered to core, but nothing appears on Today. The platform is not installed on the server, so the server drops its events. Install it in Settings › Sources › Platforms › Add. Watches from before that are not recovered.

Nothing happens when a video plays. Check that the page address is https://www.youtube.com/watch?v=… (Shorts are not reported) and that the extension is switched on in chrome://extensions. A tab that was open before you loaded or reloaded the extension needs a reload of its own.

The video shows on Today but is not mined. The extension’s part is done. See Adding YouTube.

The popup shows the orange “not accepting events from this client” box. See When the server refuses this client.

Dropped (queue full) is not 0. More than 2,000 events waited while the server was away, and the oldest were dropped. Keep the server reachable, or fix the problem shown in Last error.