Repository: yt-dlp/yt-dlp

Issue:
Regarding "Crypto" optional dependency...
 For starters, **huge thanks** for this excellent project of yours 👍 , many **praises** for your sterling coding efforts 🥇 and, which is something I value most, your _friendly attitude_ towards issue reporters, be them _simple users_ without coding skills (I fall here, I guess 😉 ... ) or knowledgeable coders alike...

In https://github.com/pukkandan/yt-dlp/commit/06ff212 you make mention of optional dependency "**C**rypto" (stress on **capital** C) and in **README.md#L107** you wrote: 
```py
    python -m pip install --upgrade pyinstaller mutagen Crypto
```
I have a local **py3.7.9 32-bit** installation (last python version to work with Vista SP2 x86), issuing 
`python -m pip install --upgrade Crypto` results in 
```
Installing collected packages: urllib3, idna, chardet, certifi, requests, pyyaml
, shellescape, Naked, Crypto
Successfully installed Crypto-1.4.1 Naked-0.1.31 certifi-2020.12.5 chardet-4.0.0
 idna-2.10 pyyaml-5.4.1 requests-2.25.1 shellescape-3.8.1 urllib3-1.26.3
```
`pypi.org` doesn't list a "**C**rypto" module, but instead a "**c**rypto" one:  
https://pypi.org/project/crypto/
which is semi-abandoned, last release was from **May 14, 2015** with version **1.4.1**...

Having been a `yt-dl` user for many years, what the devs there have _**always**_ recommended for **crypto support** inside `yt-dl` was installing either **pyCrypto**: 
https://pypi.org/project/pycrypto/
which is an abandonware from **2013** (at version **2.6.1**), or **pyCryptodome**: 
https://pypi.org/project/pycryptodome/
which is an **actively maintained** module, updated as recently as two days ago (v**3.10.1**) ...
You can read about their recommendations below: 
https://github.com/ytdl-org/youtube-dl/issues/27583#issuecomment-752610611
https://github.com/ytdl-org/youtube-dl/issues/23346#issuecomment-562919519
https://github.com/ytdl-org/youtube-dl/issues/23258#issuecomment-559607516

FWIW, officially released Windows binary `youtube-dl.exe` (compiled with py3.4.4+py2exe) has **already embedded "crypto" support** (I think with old `pyCrypto`) ...

NB that `pyCryptodome` is an in-place alternative (i.e. drop-in replacement) to old `pyCrypto`, so they **can't coexist**, nor coexist **under Windows** with `Crypto` (see [here](https://pycryptodome.readthedocs.io/en/latest/src/faq.html#why-do-i-get-the-error-no-module-named-crypto-on-windows)!) ...

For those possibly not in-the-know, I need "crypto support" in order for [**hlsnative**] to work with (decrypt) **HLSe** streams (AES-128 encrypted HLS media streams), which is a form of _soft-DRM_ targeting older iDevices (iPhone, iPad, etc.) that lack support for fully-fledged **DRM** (like cenc+Widevine/Fairplay); HLSe has been "cracked" both by **Python** and **FFmpeg**, and is being used in the vast majority of media portals supported by `yt-dl`/`yt-dlp`.

When crypto support is absent, [**hlsnative**] delegates HLSe to FFmpeg (`--hls-prefer-ffmpeg`, like in Live HLS), but using FFmpeg presents at least two shortcomings for me: 
1. Produces voluminous console output (can be suppressed with `--external-downloader-args "-v 8 -stats"`, or, in the case of `yt-dlp`, `--downloader-args ffmpeg:"-v 8 -stats"`)
2. Implies HLS stream downloads are **NON-RESUMABLE** 😢 

So, my final two questions are: 
a) Is indeed **"Crypto"** the python module `yt-dlp` should be using to handle HLSe or, perhaps, a move to actively maintained module **pyCryptodome** could be more preferable?
b) I tested your latest release, **2021.02.09**, and apparently is **incapable** of handling **HLSe** streams: 

```
[debug] Command-line config: ['--sponskrub-location', '..\\sponskrub.exe', '--ff
mpeg-location', '..\\ffmpeg.exe', '--downloader-args', 'ffmpeg:-v 8 -stats', '-v
', '--console-title', '--hls-prefer-native', '--hls-use-mpegts', '-c', '-f', 'UL
NK-1677', 'https://abc.com/shows/jimmy-kimmel-live/episode-guide/2020-12/17-jimm
y-kimmel-live-1217']
[debug] Loading archive file None
[debug] Encodings: locale cp1253, fs mbcs, out cp737, pref cp1253
[debug] yt-dlp version 2021.02.09
[debug] Python version 3.4.4 (CPython) - Windows-Vista-6.0.6003-SP2
[debug] exe versions: ffmpeg 4.3.1, ffprobe 4.3.1
[debug] Proxy map: {}
[Go] 17-jimmy-kimmel-live-1217: Downloading webpage
[Go] VDKA22148354: Downloading JSON metadata
[debug] Using fake IP 6.97.218.179 (US) as X-Forwarded-For.
[Go] VDKA22148354: Downloading JSON metadata
[Go] VDKA22148354: Downloading m3u8 information
[debug] Sort order given by user:
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, vcodec:vp9(
9), acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud,
source, id
[info] Downloading format(s) ULNK-1677
[debug] Invoking downloader on 'http://content-aeui1.uplynk.com/77ae522d2faf46a9
bdc336c964909e87/g.m3u8?exp=1613009127&ct=a&oid=d874124ecca24c88a3c9575e78686acf
&eid=e592d34ed5bc421b80c1df9dd69b6935&expand=drmOff&iph=a921475db1fae5790c8e5e99
0ab31ecfc225f6d900a2b92afae564b5e332836e&euid=F96D41C5-708D-4747-BE81-A1A572C337
05_000_0_001_sf_01-06-00_NA&cdn=ec&stgcfg=datg&rays=hjigfedcba&pp2ip=0&v=3&sig=3
7efa323e651213ec345a28c63747fdc522beb87a5277c9396a17fda8731b5af&pbs=b014adbaecc2
4ffc8ea7a6857cdbadf6'
[hlsnative] Downloading m3u8 manifest
WARNING: hlsnative has detected features it does not support, extraction will be
 delegated to ffmpeg
[download] Destination: Trump Circus Back in Washington for Impeachment Trial #2
 [VDKA22148354].mp4
[debug] ffmpeg command line: "D:\Vangelis\Installers\youtube-dl\ffmpeg" -y -logl
evel verbose -v 8 -stats -headers "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win
64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3693.5 Safari/537.36

Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
X-Forwarded-For: 6.97.218.179
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
" -i "http://content-aeui1.uplynk.com/77ae522d2faf46a9bdc336c964909e87/g.m3u8?ex
p=1613009127&ct=a&oid=d874124ecca24c88a3c9575e78686acf&eid=e592d34ed5bc421b80c1d
f9dd69b6935&expand=drmOff&iph=a921475db1fae5790c8e5e990ab31ecfc225f6d900a2b92afa
e564b5e332836e&euid=F96D41C5-708D-4747-BE81-A1A572C33705_000_0_001_sf_01-06-00_N
A&cdn=ec&stgcfg=datg&rays=hjigfedcba&pp2ip=0&v=3&sig=37efa323e651213ec345a28c637
47fdc522beb87a5277c9396a17fda8731b5af&pbs=b014adbaecc24ffc8ea7a6857cdbadf6" -c c
opy -f mpegts "file:Trump Circus Back in Washington for Impeachment Trial #2 [VD
KA22148354].mp4.part"
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10.2.1 (GCC) 20200726
  configuration: --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gn
utls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enabl
e-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencor
e-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnap
py --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --ena
ble-libvpx --enable-libwavpack --enable-libwebp --enable-libxml2 --enable-libzim
g --enable-lzma --enable-zlib --enable-gmp --enable-libvmaf --enable-libvorbis -
-enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libaom --en
able-libgsm --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cud
a-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dx
va2 --enable-libopenmpt --enable-amf
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
frame=  101 fps=0.0 q=-1.0 size=     512kB time=00:00:03.37 bitrate=1244.4kbits/
frame=  122 fps=101 q=-1.0 size=     768kB time=00:00:04.05 bitrate=1552.2kbits/
frame=  174 fps=100 q=-1.0 size=    1024kB time=00:00:05.80 bitrate=1445.6kbits/
frame=  244 fps= 94 q=-1.0 size=    1536kB time=00:00:08.19 bitrate=1536.0kbits/
frame=  301 fps= 97 q=-1.0 size=    2048kB time=00:00:10.06 bitrate=1666.2kbits/
frame=  350 fps= 96 q=-1.0 size=    2304kB time=00:00:11.69 bitrate=1614.5kbits/
frame=  367 fps= 87 q=-1.0 size=    2304kB time=00:00:12.28 bitrate=1536.0kbits/
frame=  419 fps= 89 q=-1.0 size=    2816kB time=00:00:13.99 bitrate=1648.4kbits/
frame=  487 fps= 93 q=-1.0 size=    3072kB time=00:00:16.25 bitrate=1548.1kbits/
frame=  490 fps= 86 q=-1.0 Lsize=    3348kB time=00:00:16.34 bitrate=1678.3kbits
/s speed=2.86x
```
... whereas when I use a **locally compiled** `yt-dlp` **version** (from git-master) with `pyCryptodome`, it **is capable of HLSe**: 

```
[debug] Command-line config: ['--sponskrub-location', '..\\sponskrub.exe', '--ff
mpeg-location', '..\\ffmpeg.exe', '--downloader-args', 'ffmpeg:-v 8 -stats', '-v
', '--console-title', '--hls-prefer-native', '--hls-use-mpegts', '-c', '-f', 'UL
NK-1677', 'https://abc.com/shows/jimmy-kimmel-live/episode-guide/2020-12/17-jimm
y-kimmel-live-1217']
[debug] Loading archive file None
[debug] Encodings: locale cp1253, fs utf-8, out utf-8, pref cp1253
[debug] yt-dlp version 2021.02.09+4-git-20210210-gcc2db87
[debug] Python version 3.7.9 (CPython) - Windows-Vista-6.0.6003-SP2
[debug] exe versions: ffmpeg 4.3.1, ffprobe 4.3.1
[debug] Proxy map: {}
[Go] 17-jimmy-kimmel-live-1217: Downloading webpage
[Go] VDKA22148354: Downloading JSON metadata
[debug] Using fake IP 6.3.235.17 (US) as X-Forwarded-For.
[Go] VDKA22148354: Downloading JSON metadata
[Go] VDKA22148354: Downloading m3u8 information
[debug] Sort order given by user:
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, vcodec:vp9(
9), acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud,
source, id
[info] Downloading format(s) ULNK-1677
[debug] Invoking downloader on 'http://content-aeuf1.uplynk.com/77ae522d2faf46a9
bdc336c964909e87/g.m3u8?exp=1613009540&ct=a&oid=d874124ecca24c88a3c9575e78686acf
&eid=e592d34ed5bc421b80c1df9dd69b6935&expand=drmOff&iph=814606fa23cb3db30efab68c
dd27673b3dc4be795a6494e50053bea82167f86f&euid=F62EAC28-0156-4842-97DD-A49D795D64
74_000_0_001_sf_01-06-00_NA&cdn=ec&stgcfg=datg&rays=hjigfedcba&pp2ip=0&v=3&sig=4
08acb5304e0f49ef0240982b90e85b14ea1ba4d95753a471548c37b4faecff7&pbs=e2ec8ab7a999
427b999c5803825ec259'
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 193
[download] Destination: Trump Circus Back in Washington for Impeachment Trial #2
 [VDKA22148354].mp4
[download]   4.0% of ~156.58MiB at 15.59MiB/s ETA 06:02
```
In conclusion, do your released builds encompass "crypto support" ? 
If **yes**, then the **current implementation** is not proper for fetching HLSe streams with **[hlsnative]**
If **no**, can that be considered, please? 

Thanks for your time reading this lengthy report, thanks overall for this project 👍 




Discussion:

Resolving patch:
diff --git a/pyinst.py b/pyinst.py
--- a/pyinst.py
+++ b/pyinst.py
@@ -72,7 +72,7 @@
     '--exclude-module=test',
     '--exclude-module=ytdlp_plugins',
     '--hidden-import=mutagen',
-    '--hidden-import=Crypto',
+    '--hidden-import=pycryptodome',
     'youtube_dlc/__main__.py',
 ])
 SetVersion('dist/youtube-dlc%s.exe' % _x86, VERSION_FILE)
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -20,7 +20,7 @@
     '**PS**: Many links in this document will not work since this is a copy of the README.md from Github',
     open("README.md", "r", encoding="utf-8").read()))
 
-REQUIREMENTS = ['mutagen', 'Crypto']
+REQUIREMENTS = ['mutagen', 'pycryptodome']
 
 
 if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':


Test patch: