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