summary refs log tree commit diff
diff options
context:
space:
mode:
authorMauricio Collares <mauricio@collares.org>2022-06-11 17:41:36 +0200
committerMauricio Collares <mauricio@collares.org>2022-06-11 17:54:05 +0200
commit6be823dd77ecd67bc335c272b6892bb5d7e24d7b (patch)
tree9be08616e42629501ee632df8a13952250ecad01
parente0169d7a9d324afebf5679551407756c77af8930 (diff)
downloadnixpkgs-6be823dd77ecd67bc335c272b6892bb5d7e24d7b.tar
nixpkgs-6be823dd77ecd67bc335c272b6892bb5d7e24d7b.tar.gz
nixpkgs-6be823dd77ecd67bc335c272b6892bb5d7e24d7b.tar.bz2
nixpkgs-6be823dd77ecd67bc335c272b6892bb5d7e24d7b.tar.lz
nixpkgs-6be823dd77ecd67bc335c272b6892bb5d7e24d7b.tar.xz
nixpkgs-6be823dd77ecd67bc335c272b6892bb5d7e24d7b.tar.zst
nixpkgs-6be823dd77ecd67bc335c272b6892bb5d7e24d7b.zip
youtube-dl: fallback to throttled downloads instead of aborting
-rw-r--r--pkgs/tools/misc/youtube-dl/default.nix18
1 files changed, 16 insertions, 2 deletions
diff --git a/pkgs/tools/misc/youtube-dl/default.nix b/pkgs/tools/misc/youtube-dl/default.nix
index faf4b558ad6..4d907094653 100644
--- a/pkgs/tools/misc/youtube-dl/default.nix
+++ b/pkgs/tools/misc/youtube-dl/default.nix
@@ -25,8 +25,8 @@ buildPythonPackage rec {
   };
 
   patches = [
-    # Fixes throttling on youtube.com. Without the patch downloads are capped at
-    # about 80KiB/s. See, e.g.,
+    # Fixes throttling on youtube.com by decoding a "n-parameter". Without the patch
+    # downloads are capped at about 80KiB/s. See, e.g.,
     #
     #   https://github.com/ytdl-org/youtube-dl/issues/29326
     #
@@ -37,6 +37,20 @@ buildPythonPackage rec {
       url = "https://github.com/ytdl-org/youtube-dl/compare/57044eacebc6f2f3cd83c345e1b6e659a22e4773...1e677567cd083d43f55daef0cc74e5fa24575ae3.diff";
       sha256 = "11s0j3w60r75xx20p0x2j3yc4d3yvz99r0572si8b5qd93lqs4pr";
     })
+    # The above patch may fail to decode the n-parameter (if, say, YouTube is updated). Failure to decode
+    # it blocks the download instead of falling back to the throttled version. The patch below implements
+    # better fallback behaviour.
+    (fetchpatch {
+      name = "avoid-crashing-if-nsig-decode-fails.patch";
+      url = "https://github.com/ytdl-org/youtube-dl/commit/41f0043983c831b7c0c3614340d2f66ec153087b.diff";
+      sha256 = "sha256-a72gWhBXCLjuBBD36PpZ5F/AHBdiBv4W8Wf9g4P/aBY=";
+    })
+    # YouTube changed the n-parameter format in April 2022, so decoder updates are required.
+    (fetchpatch {
+      name = "fix-n-descrambling.patch";
+      url = "https://github.com/ytdl-org/youtube-dl/commit/a0068bd6bec16008bda7a39caecccbf84881c603.diff";
+      sha256 = "sha256-tSuEns4jputa2nOOo6JsFXpK3hvJ/+z1/ymcLsd3A6w=";
+    })
   ];
 
   nativeBuildInputs = [ installShellFiles makeWrapper ];