• Stars
    star
    289
  • Rank 143,419 (Top 3 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 1 year ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

⏭️ Skip YouTube ads and sponsorships on all local Google Cast devices

CastSponsorSkip

CastSponsorSkip Icon

GitHub release (latest by date) Build Go Report Card Quality Gate Status

A Go program that skips sponsored YouTube content and skippable ads on all local Google Cast devices, using the SponsorBlock API. This project was inspired by sponsorblockcast, but written from scratch to decrease memory and CPU usage, and to work around some of its problems (see Differences from sponsorblockcast).

When 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.

Additionally, CastSponsorSkip will look for skippable YouTube ads, and automatically hit the skip button when it becomes available.

Installation

Docker

Click to expand

You can install Docker directly or use Docker Compose (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.

Docker

Run the below commands as root or a member of the docker group:

docker run --network=host --name=castsponsorskip ghcr.io/gabe565/castsponsorskip

Docker Compose

First you will need a docker-compose.yaml file, such as the one included in this repo. Run the below commands as root or a member of the docker group:

docker compose up -d

Home Assistant Addon

Click to expand

A Home Assistant addon is provided by @alexbelgium and @bruvv. See alexbelgium/hassio-addons for installation instructions.

APT (Ubuntu, Debian)

Click to expand
  1. If you don't have it already, install the ca-certificates package

    sudo apt install ca-certificates
  2. Add gabe565 apt repository

    echo 'deb [trusted=yes] https://apt.gabe565.com /' | sudo tee /etc/apt/sources.list.d/gabe565.list
    
  3. Update apt repositories

    sudo apt update
  4. Install CastSponsorSkip

    sudo apt install castsponsorskip

RPM (CentOS, RHEL)

Click to expand
  1. If you don't have it already, install the ca-certificates package

    sudo dnf install ca-certificates
  2. Add gabe565 rpm repository to /etc/yum.repos.d/gabe565.repo

    [gabe565]
    name=gabe565
    baseurl=https://rpm.gabe565.com
    enabled=1
    gpgcheck=0
  3. Install CastSponsorSkip

    sudo dnf install castsponsorskip

AUR (Arch Linux)

Click to expand

Install castsponsorskip-bin with your AUR helper of choice.

Homebrew (macOS, Linux)

Click to expand

Install CastSponsorSkip from gabe565/homebrew-tap:

brew install gabe565/tap/castsponsorskip

Kubernetes

Click to expand

CastSponsorSkip 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.

A Helm chart is available to make Kubernetes deployment even simpler. For more information, see charts.gabe565.com or Artifact Hub.

Manual Installation

Click to expand

Download and run the latest release binary for your system and architecture.

Usage

Run castsponsorskip from a terminal or activate the service with systemd:

systemctl enable --now castsponsorskip
Homebrew Instructions

Use brew services to start CastSponsorSkip:

brew services start castsponsorskip

Configuration

CastSponsorSkip can be configured with envs, command-line flags, or a config file. Some notable envs are listed below, but all flags can be set with envs.
To 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.

Notable Envs

Env Description Default
CSS_DISCOVER_INTERVAL Interval to restart the DNS discovery client. 5m
CSS_PAUSED_INTERVAL Time to wait between each poll of the Cast device status when paused. 1m
CSS_PLAYING_INTERVAL Time to wait between each poll of the Cast device status when playing. 500ms
CSS_CATEGORIES Comma-separated list of SponsorBlock categories to skip, see category list. sponsor
CSS_YOUTUBE_API_KEY YouTube API key for fallback video identification (required on some Chromecast devices).
CSS_MUTE_ADS Mutes the device while an ad is playing. true

Note sponsorblockcast envs 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.

Flags

See command-line flag documentation here.

Systemd

To modify the variables when running as a systemd service, create an override for the service with:

sudo systemctl edit castsponsorskip.service

This will open a blank override file where you can specify environment variables like so:

[Service]
Environment="CSS_PAUSED_INTERVAL=1m"
Environment="CSS_PLAYING_INTERVAL=1s"
Environment="CSS_CATEGORIES=sponsor,selfpromo"

To modify the variables when running as a Docker container, you can add arguments to the docker run command like so:

docker run --network=host --env CSS_PAUSED_INTERVAL=5m --env CSS_PLAYING_INTERVAL=2s --name=castsponsorskip ghcr.io/gabe565/castsponsorskip

Docker Compose

When using docker-compose.yaml, you can simply edit the environment directive as shown in the example file.

Differences from sponsorblockcast

  • Uses the SponsorBlock enhanced privacy endpoint. 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.
  • Compiles to a single binary. No dependencies are required other than CastSponsorSkip.
  • 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.
  • 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.
  • go-chromecast only needs to be loaded once within a single Go program, resulting on lower memory usage.
  • Dependency updates are automated with Renovate.

I 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:

Program CPU Memory
sponsorblockcast 75m 70Mi
castsponsorskip 1m 10Mi

More Repositories

1

ascii-movie

🌌 Star Wars SSH + Telnet server written in Go
Go
185
star
2

gh-profile

:octocat: Use multiple GitHub accounts with the gh cli.
Go
151
star
3

charts

☸️ A collection of Helm charts, based on the bjw-s common library chart.
YAML
93
star
4

popup-backdrop-filter

JavaScript
44
star
5

linuxserver-mod-vuetorrent

Docker mod that installs VueTorrent to the LinuxServer.io qBittorrent images
Dockerfile
41
star
6

esphome-configs

💾 A collection of my personal ESPHome configs and packages.
YAML
27
star
7

gones

🕹️ An NES emulator written in Go.
Go
17
star
8

nightscout-menu-bar

🩸 Display live blood sugar data from Nightscout in your system menu bar
Go
17
star
9

domain-watch

🔔 Get notified about domain changes as they happen.
Go
17
star
10

docker-obico

Pre-built Docker images for Obico server
16
star
11

ascii-telnet-rust

🌌 Star Wars telnet server written in Rust
Rust
14
star
12

home-ops

HomeOps driven by Kubernetes and GitOps using Flux
CSS
14
star
13

mnemonic-ninja

🔢 Website to convert between a number and its corresponding word to aid in memorization
Vue
13
star
14

pyruckus

📶 Python client for Ruckus Unleashed routers
Python
11
star
15

pre-commit-fluxcd

Pre-Commit hooks for FluxCD GitOps repos
Go
11
star
16

transsmute

📰 Build RSS feeds for websites that don't provide them.
Go
9
star
17

portfolio

👨‍💻 My personal portfolio website
Go
8
star
18

streamdeck-stopwatch

⏱️ A stopwatch plugin for the Elgato Stream Deck
JavaScript
6
star
19

relax-sounds

😌 Website that streams or casts relaxing soundscapes.
Vue
5
star
20

setup-helm-docs-action

Action that installs Helm Docs, a tool for automatically generating markdown documentation for Helm charts
5
star
21

matrimony

💒 Selfhosted wedding site
Vue
4
star
22

materialflux

📰 Material-UI frontend for Miniflux
Vue
4
star
23

go-spinners

Spinners for use in terminal Go apps
Go
4
star
24

docker-nightscout

Nightscout CGM Remote Monitor Docker Container
Dockerfile
3
star
25

pwgen-go

Command line phassphrase generator written in Go
Go
3
star
26

streamdeck-nightscout

🩸 A Nightscout plugin for the Elgato Stream Deck
JavaScript
3
star
27

geoip-cache-proxy

A GeoIP database caching proxy.
Go
2
star
28

docker-vuetorrent

VueTorrent Docker container
Dockerfile
2
star
29

docker-cloudnativepg-vecto.rs

CloudNativePG conatiner images with pgvecto.rs
Dockerfile
2
star
30

ruckus-mock-ssh

Mock SSH server written in Go that mocks a subset of Ruckus SSH commands and responses.
Go
1
star
31

scaffold

🏗️ Generate an opinionated Laravel site
Go
1
star
32

docker-borgmatic

Dockerfile
1
star
33

docker-khinsider

Container images for obskyr/khinsider
Dockerfile
1
star
34

template-kubernetes-apps-markdown

Automatically generate a repo listing for Kubernetes GitOps repos
Go
1
star
35

submarine-cable-map-downloader

Download full-resolution versions of Telegeography Submarine Cable Maps
Go
1
star
36

renovate-config

1
star
37

docker-pixlet

Docker container with Tidbyt's Pixlet cli tool
Dockerfile
1
star
38

cli-of-life

Play Conway's Game of Life in your terminal
Go
1
star
39

homebrew-tap

gabe565 Homebrew Tap
Ruby
1
star
40

docker-stable-diffusion

Dockerfile
1
star
41

external-dns-dynamic-ip

Simple cron job that fixes external-dns when running behind a NAT with MetalLB
Shell
1
star
42

patrol

🕵️ Website to randomly pick a game role
SCSS
1
star