{"id":13609794,"url":"https://github.com/gabe565/CastSponsorSkip","last_synced_at":"2025-04-12T20:32:24.068Z","repository":{"id":188216757,"uuid":"678312270","full_name":"gabe565/CastSponsorSkip","owner":"gabe565","description":"Skip YouTube sponsorships (and sometimes ads) on all local Google Cast devices.","archived":false,"fork":false,"pushed_at":"2025-04-03T20:16:07.000Z","size":529,"stargazers_count":374,"open_issues_count":16,"forks_count":9,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-12T04:44:24.317Z","etag":null,"topics":["chromecast","google-cast","sponsorblock","youtube"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gabe565.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-08-14T09:00:01.000Z","updated_at":"2025-04-06T03:39:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"8cbcd40e-ab5a-4b01-b700-6c56aa0d0f83","html_url":"https://github.com/gabe565/CastSponsorSkip","commit_stats":{"total_commits":291,"total_committers":8,"mean_commits":36.375,"dds":"0.15807560137457044","last_synced_commit":"86f16a21d3a5699a917b12f591e251c775d6640a"},"previous_names":["gabe565/sponsorblockcast","gabe565/sponsorblockcast-go","gabe565/castsponsorskip"],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabe565%2FCastSponsorSkip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabe565%2FCastSponsorSkip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabe565%2FCastSponsorSkip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabe565%2FCastSponsorSkip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gabe565","download_url":"https://codeload.github.com/gabe565/CastSponsorSkip/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248629988,"owners_count":21136357,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chromecast","google-cast","sponsorblock","youtube"],"created_at":"2024-08-01T19:01:38.117Z","updated_at":"2025-04-12T20:32:24.036Z","avatar_url":"https://github.com/gabe565.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# CastSponsorSkip\n\n\u003cimg src=\"./assets/icon.svg\" alt=\"CastSponsorSkip Icon\" align=\"right\" width=\"90\"\u003e\n\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/gabe565/CastSponsorSkip)](https://github.com/gabe565/CastSponsorSkip/releases)\n[![Build](https://github.com/gabe565/CastSponsorSkip/actions/workflows/build.yml/badge.svg)](https://github.com/gabe565/CastSponsorSkip/actions/workflows/build.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/gabe565/CastSponsorSkip)](https://goreportcard.com/report/github.com/gabe565/CastSponsorSkip)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=gabe565_CastSponsorSkip\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=gabe565_CastSponsorSkip)\n\nA Go program that skips sponsored YouTube content and skippable ads on all local Google Cast devices, using the [SponsorBlock](https://github.com/ajayyy/SponsorBlock) API. This project was inspired by [sponsorblockcast](https://github.com/nichobi/sponsorblockcast), but written from scratch to decrease memory and CPU usage, and to work around some of its problems (see [Differences from sponsorblockcast](#differences-from-sponsorblockcast)).\n\nWhen run, this program will watch all Google Cast devices on the LAN. If a Cast device begins playing a YouTube video, sponsored segments are fetched from the SponsorBlock API. When the device reaches a sponsored segment, the CastSponsorSkip will quickly seek to the end of the segment.\n\nAdditionally, CastSponsorSkip will look for skippable YouTube ads, and automatically hit the skip button when it becomes available.\n\n## Installation\n\n### Docker\n\n\u003cdetails\u003e\n  \u003csummary\u003eClick to expand\u003c/summary\u003e\n\n  You can [install Docker](https://docs.docker.com/engine/install/) directly or use [Docker Compose](https://docs.docker.com/compose/install/) (Or use Podman, Portainer, etc). Please note you *MUST* use the `host` network as shown below for cli or in the example `docker-compose` file.\n\n  #### Docker\n  Run the below commands as root or a member of the `docker` group:\n  ```shell\n  docker run --network=host --name=castsponsorskip ghcr.io/gabe565/castsponsorskip\n  ```\n\n  #### Docker Compose\n  First you will need a `docker-compose.yaml` file, such as the [one included in this repo](docker-compose.yaml). Run the below commands as root or a member of the `docker` group:\n  ```shell\n  docker compose up -d\n  ```\n\u003c/details\u003e\n\n\n### Home Assistant Addon\n\n\u003cdetails\u003e\n  \u003csummary\u003eClick to expand\u003c/summary\u003e\n\nA Home Assistant addon is provided by @alexbelgium and @bruvv. See [alexbelgium/hassio-addons](https://github.com/alexbelgium/hassio-addons/tree/master/sponsorblockcast) for installation instructions.\n\u003c/details\u003e\n\n\n### APT (Ubuntu, Debian)\n\n\u003cdetails\u003e\n  \u003csummary\u003eClick to expand\u003c/summary\u003e\n\n1. If you don't have it already, install the `ca-certificates` package\n   ```shell\n   sudo apt install ca-certificates\n   ```\n\n2. Add gabe565 apt repository\n   ```\n   echo 'deb [trusted=yes] https://apt.gabe565.com /' | sudo tee /etc/apt/sources.list.d/gabe565.list\n   ```\n\n3. Update apt repositories\n   ```shell\n   sudo apt update\n   ```\n\n4. Install CastSponsorSkip\n   ```shell\n   sudo apt install castsponsorskip\n   ```\n\u003c/details\u003e\n\n### RPM (CentOS, RHEL)\n\n\u003cdetails\u003e\n  \u003csummary\u003eClick to expand\u003c/summary\u003e\n\n1. If you don't have it already, install the `ca-certificates` package\n   ```shell\n   sudo dnf install ca-certificates\n   ```\n\n2. Add gabe565 rpm repository to `/etc/yum.repos.d/gabe565.repo`\n   ```ini\n   [gabe565]\n   name=gabe565\n   baseurl=https://rpm.gabe565.com\n   enabled=1\n   gpgcheck=0\n   ```\n\n3. Install CastSponsorSkip\n   ```shell\n   sudo dnf install castsponsorskip\n   ```\n\u003c/details\u003e\n\n### AUR (Arch Linux)\n\n\u003cdetails\u003e\n  \u003csummary\u003eClick to expand\u003c/summary\u003e\n\nInstall [castsponsorskip-bin](https://aur.archlinux.org/packages/castsponsorskip-bin) with your [AUR helper](https://wiki.archlinux.org/index.php/AUR_helpers) of choice.\n\u003c/details\u003e\n\n### Homebrew (macOS, Linux)\n\n\u003cdetails\u003e\n  \u003csummary\u003eClick to expand\u003c/summary\u003e\n\nInstall CastSponsorSkip from [gabe565/homebrew-tap](https://github.com/gabe565/homebrew-tap):\n```shell\nbrew install gabe565/tap/castsponsorskip\n```\n\u003c/details\u003e\n\n### Kubernetes\n\n\u003cdetails\u003e\n  \u003csummary\u003eClick to expand\u003c/summary\u003e\n\nCastSponsorSkip doesn't require a Service or Ingress, so it's simple to host in Kubernetes with a single Deployment. The only gotcha is that `hostNetwork` must be enabled for device discovery to work.\n\nA Helm chart is available to make Kubernetes deployment even simpler.\nFor more information, see\n[charts.gabe565.com](https://charts.gabe565.com/charts/castsponsorskip/) or\n[Artifact Hub](https://artifacthub.io/packages/helm/gabe565/castsponsorskip).\n\u003c/details\u003e\n\n### Manual Installation\n\n\u003cdetails\u003e\n  \u003csummary\u003eClick to expand\u003c/summary\u003e\n\nDownload and run the [latest release binary](https://github.com/gabe565/CastSponsorSkip/releases/latest) for your system and architecture.\n\u003c/details\u003e\n\n## Usage\nRun `castsponsorskip` from a terminal or activate the service with systemd:\n```shell\nsystemctl enable --now castsponsorskip\n````\n\n\u003cdetails\u003e\n  \u003csummary\u003eHomebrew Instructions\u003c/summary\u003e\n\n  Use [brew services](https://github.com/Homebrew/homebrew-services) to start CastSponsorSkip:\n  ```shell\n  brew services start castsponsorskip\n  ```\n\u003c/details\u003e\n\n## Configuration\nCastSponsorSkip can be configured with envs, command-line flags, or a config file. Some notable envs are listed below, but all [flags](./docs/castsponsorskip.md) can be set with envs.  \nTo use an env that is not listed here, capitalize all characters, replace `-` with `_`, and prefix with `CSS_`. For example, `--paused-interval=1m` would become `CSS_PAUSED_INTERVAL=1m`.\n\n### Notable Envs\nHere's a list of commonly used envs. Also see [full env reference](docs/envs.md).\n\n| Env                     | Description                                                                                                                                                                                                           | Default   |\n|-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------|\n| `CSS_DISCOVER_INTERVAL` | Interval to restart the DNS discovery client.                                                                                                                                                                         | `5m`      |\n| `CSS_PAUSED_INTERVAL`   | Time to wait between each poll of the Cast device status when paused.                                                                                                                                                 | `1m`      |\n| `CSS_PLAYING_INTERVAL`  | Time to wait between each poll of the Cast device status when playing.                                                                                                                                                | `500ms`   |\n| `CSS_CATEGORIES`        | Comma-separated list of SponsorBlock categories to skip, see [category list](https://wiki.sponsor.ajay.app/w/Types#Category) and [category breakdown](https://wiki.sponsor.ajay.app/w/Guidelines#Category_Breakdown). | `sponsor` |\n| `CSS_YOUTUBE_API_KEY`   | [YouTube API key](https://developers.google.com/youtube/registering_an_application) for fallback video identification (required on some Chromecast devices).                                                          | ` `       |\n| `CSS_MUTE_ADS`          | Mutes the device while an ad is playing.                                                                                                                                                                              | `true`    |\n| `CSS_DEVICES`           | Comma-separated list of device addresses. This will disable discovery and is not recommended unless discovery fails.                                                                                                  | `[]`      |\n| `CSS_SKIP_SPONSORS`     | Toggles sponsored segment skipping via the SponsorBlock API. If disabled, only YouTube ads will be skipped.                                                                                                           | `true`    |\n\n\u003e [!NOTE]\n\u003e [sponsorblockcast envs](https://github.com/nichobi/sponsorblockcast#configuration) are also supported to simplify the migration to CastSponsorSkip. When used, a deprecation warning will be logged with an updated env key and value. There are currently no plans to remove these envs.\n\n### Flags\nSee [command-line reference](./docs/castsponsorskip.md).\n\n### Systemd\nTo modify the variables when running as a systemd service, create an override for the service with:\n\n```shell\nsudo systemctl edit castsponsorskip.service\n```\n\nThis will open a blank override file where you can specify environment variables like so:\n```\n[Service]\nEnvironment=\"CSS_PAUSED_INTERVAL=1m\"\nEnvironment=\"CSS_PLAYING_INTERVAL=1s\"\nEnvironment=\"CSS_CATEGORIES=sponsor,selfpromo\"\n```\n\nTo modify the variables when running as a Docker container, you can add arguments to the `docker run` command like so:\n\n```shell\ndocker run --network=host --env CSS_PAUSED_INTERVAL=5m --env CSS_PLAYING_INTERVAL=2s --name=castsponsorskip ghcr.io/gabe565/castsponsorskip\n```\n\n### Docker Compose\nWhen using `docker-compose.yaml`, you can simply edit the `environment` directive as shown in the [example file](./docker-compose.yaml).\n\n## Differences from sponsorblockcast\n- Uses the SponsorBlock [enhanced privacy endpoint](https://wiki.sponsor.ajay.app/w/API_Docs#GET_/api/skipSegments/:sha256HashPrefix). When searching for sponsored segments, the video ID is hashed and only the first 4 characters of the hash are passed to SponsorBlock. This allows CastSponsorSkip to fetch segments without telling SponsorBlock what video is being watched.\n- Compiles to a single binary. No dependencies are required other than CastSponsorSkip.\n- Scans Cast device status much less frequently when a YouTube video is not playing, resulting in decreased CPU usage and less stress on the Cast device.\n- Written Go, which is the same language as `go-chromecast`. This means `go-chromecast` functions can be called directly instead of relying on shell scripts, child commands, or string parsing.\n- `go-chromecast` only needs to be loaded once within a single Go program, resulting in lower memory usage.\n- Dependency updates are automated with Renovate.\n\nI own 12 Google Cast devices, and have compared CPU and memory usage of the two programs. Note that CPU usage is measured in \"milliCPU\", meaning that 1m is equal to 1/1000 of a CPU. Here are the averages:\n\n| Program             | CPU | Memory |\n|---------------------|-----|--------|\n| sponsorblockcast    | 75m | 70Mi   |\n| castsponsorskip | 1m  | 10Mi   |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabe565%2FCastSponsorSkip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgabe565%2FCastSponsorSkip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabe565%2FCastSponsorSkip/lists"}