oignon: uninstall chromium
[julm/julm-nix.git] / home-manager / profiles / yt-dlp.nix
index 2130be1cc070bcb2f63cb84bf343ff1b1d449fc1..9beb9167aebe11beba4f562494d513465d364808 100644 (file)
@@ -1,21 +1,41 @@
-{ pkgs, lib, config, ... }:
+{ pkgs, lib, ... }:
 {
-imports = [
-  ./aria2c.nix
-];
-home.packages = [ pkgs.yt-dlp ];
-xdg.configFile."yt-dlp/config".text = ''
-  --download-archive .downloaded
-  --format ${lib.concatStringsSep "/" [
-    "bestvideo[height=360][ext=mp4]+bestaudio"
-    "bestvideo[height<=480][ext=mp4]+bestaudio"
-    "best[height=360][ext=mp4]"
-    "best[height<=480][ext=mp4]"
-    "best[height=360]"
-    "best[height<=480]"
-    "best"
-  ]}
-  --output %(upload_date>%Y-%m-%d)s - %(title)s.%(id)s.%(format_id)s.%(ext)s
-  --prefer-free-formats
-'';
+  imports = [
+    ./aria2c.nix
+  ];
+  home.packages = [
+    # error: phantomjs 1.9.8 has been dropped due to lack of maintenance and security issues
+    #pkgs.phantomjs
+    pkgs.yt-dlp
+  ];
+  programs.bash.shellAliases = {
+    yt = "yt-dlp";
+    yt-audio = "yt-dlp -f 'worstaudio[acodec=opus]/worstaudio'";
+  };
+  xdg.configFile."yt-dlp/config".text = ''
+    #--download-archive .downloaded
+    --external-downloader aria2c
+    --embed-chapters
+    --embed-subs
+    --sub-langs all
+    --format ${lib.concatStringsSep "/" [
+      "bestvideo[height<=480][vcodec=av1]+bestaudio"
+      #"bestvideo[height<=480][vcodec=vp9]+bestaudio"
+      "bestvideo[height<=480][ext=mp4]+bestaudio"
+      "bestvideo[height<=480]+bestaudio"
+
+      "best[height<=480][ext=av1]"
+      #"best[height<=480][ext=vp9]"
+      "best[height<=480][ext=mp4]"
+      "best[height<=480]"
+
+      "best"
+    ]}
+    --output "%(release_date>%Y-%m-%d,upload_date>%Y-%m-%d)s - %(title)s.%(id)s.%(format_id)s.%(ext)s"
+    --match-filter !is_live
+    --prefer-free-formats
+    --sub-format ass/srt/best
+    --sub-langs "en.*,fr,-live_chat,-rechat"
+    --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0"
+  '';
 }