ytcs

ytcs.sh

This script is a simple tool to fetch YouTube subscriptions via RSS feed and watch them using mpv and youtube-dl, thus enabling using your login cookies from Firefox, and allowing the viewing of videos.

The script presents the subscriptions in a rofi or fzf menu, making it easy to navigate and select the videos you want to watch.

Video of ytcs in action

Updated to include https://github.com/Brainicism/bgutil-ytdlp-pot-provider

Prerequisites

The script requires the following programs to be installed:

Installation

This tool can be installed by cloning the repository to your local machine and then running the script.

Usage

Playing a single video

It is possible to simply use this as a way to pipe a YouTube url to mpv. It will also include that in your “seen” videos. Simply

ytcs.sh [url]

where the url is either the full url to the video, or the shortened https://youtu.be/ format.

Browsing Subscriptions.

There are several commands available with this script when used to browse videos:

ytcs.sh [--loud] [--help] [--import FILENAME] [--refresh] [--subscription|--grouped|--time]

You may use any combination of these:

Choose ONE of the three of these:

For example, you can refresh your subscriptions using the –refresh command like this:

./ytcs.sh --refresh

Ideally, you’d do that with a cron job; it does take a moment, and caches the results for quick user input.

You can use the –import command to import your subscriptions from a csv file like this:

./ytcs.sh --import /path/to/csv

See the notes below.

You can also browse your videos by group, by time or by subscription using the –grouped , –time , and –subscription commands respectively. In grouped and time based view, it will compare to a watched file, and update it if you’ve watched and videos.

Keep in mind that since it’s powered by rofi or fzf, you can search among the titles in any of these views.

./ytcs.sh --grouped 

./ytcs.sh --time 

./ytcs.sh --subscription 

Configuration

Rename the file ytcs.env.example to ytcs.env and edit it. The example file has the defaults:

export ROFI_THEME="arthur"
export MAX_CHANNEL_AGE=182
export MAX_GROUPED_VIDS=10
#export watchtop=4
export LOUD=0
export YTDLP_COOKIES="firefox"
export MARK_AGE="TRUE"
export GEOMETRY1="1366x768+50%+50%"
export GEOMETRY2="1366x768"

export YTPOT_BASEURL="youtubepot-bgutilhttp:base_url=http://127.0.0.1:8080" is used ONLY if you have the BGUtil POTS provider on a non-default host or port as described in its documentation.

The value watchtop is used for process control; while parsing data, ytcs will attempt to use a number of subshells equal to your processor cores unless watchtop is set to a positive value to limit the number of cores.

I personally use the “arthur_modified” rofi theme included here which has some small tweaks.

YTDLP_COOKIES is used to control which browser yt-dlp gets cookies from.

MARK_AGE determines whether the visual marking of video age is displayed, change to anything but “TRUE” to turn off.

GEOMETRY1 and GEOMETRY2 are for mpv; they correspond to --geometry=${GEOMETRY1} --autofit=${GEOMETRY2}.

Notes

TODO

TODO - Demo TODO - I mean, it’s spaghetti code. It works, it is nowhere near optimized, and is probably got issues in some way
TODO - sort grouped by channel age (this is REALLY kicking my ass.) TODO - filter EXCLUDE terms (new feature)