nichobi / sponsorblockcast

A shell script that skips sponsored YouTube content on all local Chromecasts
GNU General Public License v3.0
348 stars 15 forks source link

Archived

sponsorblockcast has been superseded by CastSponsorSkip, written by gabe565. I recommend moving over to it for improved performance and privacy. sponsorblockcast will no longer be maintained.

sponsorblockcast

A POSIX shell script that skips sponsored YouTube content and skippable ads on all local Chromecasts, using the SponsorBlock API. It was inspired by CastBlock but written from scratch to avoid some of its pitfalls (see Differences from CastBlock).

Care was taken to ensure it's fully POSIX-compatible, so it can run on lighter shells such as Dash.

The script will scan for all Chromecasts on the LAN, and launches a process for each one to efficiently poll it status every second. If a Chromecast is found to be playing a YouTube video, sponsor segments are fetched from the SponsorBlock API and stored in a temporary file. Whenever the Chromecast reaches a sponsored segment, the script tells it to seek to the end of the segment.

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

Installation

Arch Linux

Install sponsorblockcast-git with your AUR helper of choice or with makepkg.

Docker image

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 Docker or in the example for docker-compose.

Docker

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

Docker Compose

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

Manual installation

Dependencies

Usage

Run sponsorblockcast from a terminal or activate the service with systemctl enable --now sponsorblockcast

Configuration

You can configure the following parameters by setting the appropriate environment values:

To run from the terminal with custom parameters you can use env like so: env SBCSCANINTERVAL=10 SBCPOLLINTERVAL=100 SBCCATEGORIES="sponsor selfpromo" sponsorblockcast

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

sudo systemctl edit sponsorblockcast.service

This will open a blank override file where you can specify Environment values like so:

[Service]
Environment="SBCPOLLINTERVAL=10"
Environment="SBCSCANINTERVAL=100"
Environment="SBCCATEGORIES=sponsor selfpromo"
Environment="SBCYOUTUBEAPIKEY=<your private API key>"

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 SBCPOLLINTERVAL=10 --env SBCSCANINTERVAL=100 --name sponsorblockcast sponsorblockcast:latest

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

Differences from CastBlock