···2525 };
26262727 patches = [
2828- # Fixes throttling on youtube.com. Without the patch downloads are capped at
2929- # about 80KiB/s. See, e.g.,
2828+ # Fixes throttling on youtube.com by decoding a "n-parameter". Without the patch
2929+ # downloads are capped at about 80KiB/s. See, e.g.,
3030 #
3131 # https://github.com/ytdl-org/youtube-dl/issues/29326
3232 #
···3636 name = "fix-youtube-dl-speed.patch";
3737 url = "https://github.com/ytdl-org/youtube-dl/compare/57044eacebc6f2f3cd83c345e1b6e659a22e4773...1e677567cd083d43f55daef0cc74e5fa24575ae3.diff";
3838 sha256 = "11s0j3w60r75xx20p0x2j3yc4d3yvz99r0572si8b5qd93lqs4pr";
3939+ })
4040+ # The above patch may fail to decode the n-parameter (if, say, YouTube is updated). Failure to decode
4141+ # it blocks the download instead of falling back to the throttled version. The patch below implements
4242+ # better fallback behaviour.
4343+ (fetchpatch {
4444+ name = "avoid-crashing-if-nsig-decode-fails.patch";
4545+ url = "https://github.com/ytdl-org/youtube-dl/commit/41f0043983c831b7c0c3614340d2f66ec153087b.diff";
4646+ sha256 = "sha256-a72gWhBXCLjuBBD36PpZ5F/AHBdiBv4W8Wf9g4P/aBY=";
4747+ })
4848+ # YouTube changed the n-parameter format in April 2022, so decoder updates are required.
4949+ (fetchpatch {
5050+ name = "fix-n-descrambling.patch";
5151+ url = "https://github.com/ytdl-org/youtube-dl/commit/a0068bd6bec16008bda7a39caecccbf84881c603.diff";
5252+ sha256 = "sha256-tSuEns4jputa2nOOo6JsFXpK3hvJ/+z1/ymcLsd3A6w=";
3953 })
4054 ];
4155