{ pkgs, lib, ... }:
{
  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-sort +res~480,+vcodec:av01,+acodec:opus
    --format ${lib.concatStringsSep "/" [
      "bestvideo+bestaudio"
      "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"
  '';
}