]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/yt-dlp.nix
yt-dlp: use nixpkgs-unstable
[julm/julm-nix.git] / home-manager / profiles / yt-dlp.nix
1 {
2 pkgs,
3 pkgs-unstable,
4 lib,
5 ...
6 }:
7 {
8 imports = [
9 ./aria2c.nix
10 ];
11 home.packages = [
12 # error: phantomjs 1.9.8 has been dropped due to lack of maintenance and security issues
13 #pkgs.phantomjs
14 pkgs-unstable.yt-dlp
15 pkgs.ffmpeg-full
16 pkgs.podl
17 ];
18 programs.bash = {
19 initExtra = ''
20 yt-ffmpeg () {
21 yt-dlp \
22 --external-downloader ffmpeg \
23 --external-downloader-args "ffmpeg_i: $FFMPEG_FLAGS" \
24 "$@"
25 }
26 '';
27 shellAliases = {
28 yt = "yt-dlp";
29 yt-480p = "yt-subs --format-sort '+res~480,+vcodec:av01,+acodec:opus'";
30 yt-audio = "yt-dlp -f 'worstaudio[acodec=opus]/worstaudio'";
31 yt-subs = "yt-dlp --write-subs --write-auto-sub --skip-download";
32 yt-subs-fr = "yt-subs --sub-langs '-all,fr-orig,fr'";
33 };
34 };
35 xdg.configFile."yt-dlp/config".text = ''
36 #--download-archive .downloaded
37 --external-downloader aria2c
38 --embed-chapters
39 --embed-subs
40 --sub-langs all
41 --format-sort +res~720,+res~480,+vcodec:av01,+acodec:opus
42 --format ${
43 lib.concatStringsSep "/" [
44 "bestvideo+bestaudio"
45 "best"
46 ]
47 }
48 --output "%(release_date>%Y-%m-%d,upload_date>%Y-%m-%d)s - %(title).150B.%(id)s.%(format_id)s.%(ext)s"
49 --match-filter !is_live
50 --prefer-free-formats
51 --sub-format ass/srt/best
52 --sub-langs "en.*,fr,zh.*,-live_chat,-rechat"
53 --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0"
54 '';
55 }