]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/yt-dlp.nix
yt-dlp: fix format selection
[julm/julm-nix.git] / home-manager / profiles / yt-dlp.nix
1 { pkgs, lib, ... }:
2 {
3 imports = [
4 ./aria2c.nix
5 ];
6 home.packages = [
7 # error: phantomjs 1.9.8 has been dropped due to lack of maintenance and security issues
8 #pkgs.phantomjs
9 pkgs.yt-dlp
10 ];
11 programs.bash.shellAliases = {
12 yt = "yt-dlp";
13 yt-audio = "yt-dlp -f 'worstaudio[acodec=opus]/worstaudio'";
14 };
15 xdg.configFile."yt-dlp/config".text = ''
16 #--download-archive .downloaded
17 --external-downloader aria2c
18 --embed-chapters
19 --embed-subs
20 --sub-langs all
21 --format ${lib.concatStringsSep "/" [
22 "bestvideo[height<=480][vcodec=av1]+bestaudio"
23 "bestvideo[height<=480][vcodec=avc]+bestaudio"
24 #"bestvideo[height<=480][vcodec=vp9]+bestaudio"
25 "bestvideo[height<=480][ext=mp4]+bestaudio"
26 "bestvideo[height<=480]+bestaudio"
27
28 "best[height<=480][vcodec=av1]"
29 "best[height<=480][vcodec=avc]"
30 #"best[height<=480][ext=vp9]"
31 "best[height<=480][ext=mp4]"
32 "best[height<=480]"
33
34 "best"
35 ]}
36 --output "%(release_date>%Y-%m-%d,upload_date>%Y-%m-%d)s - %(title)s.%(id)s.%(format_id)s.%(ext)s"
37 --match-filter !is_live
38 --prefer-free-formats
39 --sub-format ass/srt/best
40 --sub-langs "en.*,fr,-live_chat,-rechat"
41 --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0"
42 '';
43 }