site

files for beauhilton.com
git clone https://git.beauhilton.com/site.git
Log | Files | Refs

commit 6c401d7f4437c655d59b15513ec239667daad985
parent fcc503518db7d5130ce54c23b26242d4f5b55f37
Author: beau hilton <cbeauhilton@gmail.com>
Date:   Thu, 19 Oct 2023 14:39:22 -0500

minor updates

Diffstat:
Mindex.json | 2+-
Msh.sh | 4++++
Msite/posts/template.md | 2+-
Msite/posts/yt-dlp.md | 58+++++++++++++++++++++++++++++++++++++++-------------------
4 files changed, 45 insertions(+), 21 deletions(-)

diff --git a/index.json b/index.json @@ -5,7 +5,7 @@ "nav_path": [ "posts" ], - "excerpt": "`yt-dlp` is an incredibly useful and customizable tool \nfor downloading online videos\nfrom YouTube and elsewhere.\nHere's my setup \n(declared in Nix, but easily generalizable).", + "excerpt": "yt-dlp is an incredibly useful and customizable tool \nfor downloading online videos\nfrom YouTube and elsewhere.\nHere's my setup \n(declared in Nix, but easily generalizable).", "date": "2023-10-19", "title": "yt-dlp Nix config" }, diff --git a/sh.sh b/sh.sh @@ -1,3 +1,7 @@ +# for non-Nix systems: +# running sh.sh will make a nice dev env with preview and auto-rebuild +# for Nix systems, +# just cd into the directory and the enterShell command takes care of it $TERMINAL -e caretaker &>/dev/null & disown $TERMINAL -e python3 -m http.server --directory build &>/dev/null & disown $TERMINAL -e $BROWSER http://localhost:8000 &>/dev/null & disown diff --git a/site/posts/template.md b/site/posts/template.md @@ -1,4 +1,4 @@ -# Fascinating title +# Post Template <time id="post-date">1978-01-01</time> diff --git a/site/posts/yt-dlp.md b/site/posts/yt-dlp.md @@ -3,7 +3,7 @@ <time id="post-date">2023-10-19</time> <p id="post-excerpt"> -`yt-dlp` is an incredibly useful and customizable tool +yt-dlp is an incredibly useful and customizable tool for downloading online videos from YouTube and elsewhere. Here's my setup @@ -19,7 +19,7 @@ for retrieving videos from YouTube (and other websites - e.g. Vimeo) for local use, but eventually it got old and crufty. -[`yt-dlp`](https://github.com/yt-dlp/yt-dlp) is a fork of youtube-dl +[yt-dlp](https://github.com/yt-dlp/yt-dlp) is a fork of youtube-dl that is more actively maintained, with many upgrades. @@ -42,17 +42,17 @@ Videos go offline for strange, sundry, and unpredictable reasons. (I maintain that YouTube and related video sites, taken as a whole, are the single greatest source of procedural knowledge -ever created by humankind \* - +ever created by humankind\* - the problems that threaten their utility are, first, curation, and second, durability) ## configuring -`yt-dlp` accepts a config file, +yt-dlp accepts a config file, usually placed at `~/.config/yt-dlp/config`, so you don't have to have a super long string of flags and options -in your shell command to `yt-dlp` +in your shell command to yt-dlp (you can override your config file with shell options, so it's reasonable to set your defaults to your most common use and not worry about messing up some divergent situation that may come up). @@ -69,15 +69,15 @@ yt-dlp "https://www.youtube.com/c/JohnWatsonRooney" And it did something like this: -![`yt-dlp` downloading example](/images/yt-dlp-downloading-example.jpg) +![yt-dlp downloading example](/images/yt-dlp-downloading-example.png) Resulting in: -![`yt-dlp` filename example](/images/yt-dlp-filename-example.jpg) +![yt-dlp filename example](/images/yt-dlp-filename-example.jpg) In the second screenshot you can see that some files are still in process - when all the parts are downloaded, -`yt-dlp` smushes them into an mkv container, +yt-dlp smushes them into an mkv container, so the videos/thumbnails/subtitle files are clean and accessible to most video players. ## config @@ -85,15 +85,15 @@ so the videos/thumbnails/subtitle files are clean and accessible to most video p Here's my config file, with some annotation. I'm using Nix with Home Manager, -but you can translate this into the usual `yt-dlp` config file syntax with ease. +but you can translate this into the usual yt-dlp config file syntax with ease. One of the great things about Nix is that it lets me group installation and configuration for programs that make sense together - -here, I want to use `aria2` as the downloader, -so I declare the `aria2` options to pass to `yt-dlp`, -and also make sure `aria2` is installed -(it's ok if you installed `aria2` in another part of your setup - +here, I want to use aria2 as the downloader, +so I declare the aria2 options to pass to yt-dlp, +and also make sure aria2 is installed +(it's ok if you installed aria2 in another part of your setup - if a program is declared for installation in multiple places, Nix is smart enough to install it only once, so it's often wise to err on the side of bundling). @@ -111,14 +111,34 @@ but the principle scales to arbitrarily complex setups. embed-chapters = true; # embed all the things embed-metadata = true; embed-thumbnail = true; - convert-thumbnail = "jpg"; # so every file manager can show the thumbnail - webp support is not quite universal + convert-thumbnail = "jpg"; + # so every file manager can show the thumbnail - webp support is not quite universal embed-subs = true; - sub-langs = "all"; # subtitle files are very small, and sometimes language names are declared badly, so worth it to grab them all + sub-langs = "all"; + # subtitle files are very small, + # and sometimes language names are declared badly, + # so worth it to grab them all downloader = "aria2c"; - downloader-args = "aria2c:'-c -x16 -s16 -k2M'"; # -c is resume if interrupted ("continue"), -x is max connections to a server, -s is number of connections used for download of a specific file, -k is size of chunks - download-archive = "yt-dlp-archive.txt"; # writes a file to the current directory specifying which files have already been downloaded - nice for updating your collection of a channel's videos (just run the download command again and it will grab only what you're missing) + downloader-args = "aria2c:'-c -x16 -s16 -k2M'"; + # -c is resume if interrupted ("continue"), + # -x is max connections to a server, + # -s is number of connections used for download of a specific file, + # -k is size of chunks + download-archive = "yt-dlp-archive.txt"; + # writes a file to the current directory specifying which files have already been downloaded - + # nice for updating your collection of a channel's videos + # (just run the download command again and it will grab only what you're missing) restrict-filenames = true; # disallow spaces, weird characters, etc. - output = "%(upload_date>%Y-%m-%d)s--%(uploader)s--%(title)s--%(id)s.%(ext)s"; # I like to be able to sort by date and have enough info in the filename so I don't need to open it to find out what it is, so I include the ISO 8601-style year, the uploader's name, the title of the video, and the video ID for easy copy pasta if I ever want to find it online, e.g. to see the comment section or show notes. + output = "%(upload_date>%Y-%m-%d)s--%(uploader)s--%(title)s--%(id)s.%(ext)s"; + # I like to be able to sort by date + # and have enough info in the filename + # so I don't need to open it to find out what it is, + # so I include the: + # - ISO 8601-style date + # - uploader's name + # - title of the video + # - video ID (for easy copy pasta if I ever want to find it online, + # e.g. to see the comment section or show notes.) }; }; programs.aria2 = { @@ -135,7 +155,7 @@ things that go online do *not* stay online forever: and is [probably going to get worse](https://blog.archive.org/2023/03/25/the-fight-continues/) before it gets better ("?better"). This section is under an asterisk and at the end because it is a side thought, -just an idea that tools like `yt-dlp` +just an idea that tools like yt-dlp may have import that goes beyond helping me write web scrapers, build saunas, etc. - maybe they have the primitives to help build a