Over the years I’ve collected ~300 favourite videos and unfortunately some of them have been taken down. I have spent some time re-watching the old videos and still enjoy them. Few are just for laughs, some are educational and others are just art. As there are not too many of them, I can just download them all to my archives. 14 videos that were missing on Youtube I’ve recovered from https://web.archive.org
The resulting archive weighs in at just 13G, so it really is a no-brainer to keep it offline.
# https://gist.github.com/guidocella/a272b6e68f9c44532b011f6596e95c61
{
echo '# Netscape HTTP Cookie File' # needed by youtube-dl
QUERY="SELECT
host_key,
IIF(host_key LIKE '.%', 'TRUE', 'FALSE'),
path,
IIF(is_secure, 'TRUE', 'FALSE'),
IIF(expires_utc == 0, 0, expires_utc / 1000000 - 11644473600),
name,
value
FROM cookies;"
# There is no attempt to url encode $1, but SQLite already handles
# characters like spaces, so only ? % and # should cause issues.
sqlite3 -readonly -separator $'\t' \
"file:${1:-$HOME/.local/share/qutebrowser}/webengine/Cookies?nolock=1" \
"$QUERY"
} > cookies.txt
yt-dlp --ignore-errors \
--download-archive archive.txt \
--cookies cookies.txt \
'https://www.youtube.com/playlist?list=LL'