-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError: AES key must be either 16, 24, or 32 bytes long #21806
Comments
Most likely broken key URL in manifest. |
I am able to watch the videos just fine in the browser. However, when I try to download them, I get this error. Also, this error occurs irrespective of which video I try to download and irrespective of whether I try to download using the playlist.m3u8 file or the chunklist_w*********.m3u8 file. For further diagnosis' sake, please find the URLs in the attached excel file. I need to download the videos because there's a limit that I can watch videos only up to 4 times on the website. |
I think the key request, requires specific cookies/headers, try to pass them with |
the headers you're looking at are not the ones that I'm referring to, I said the headers of the key request, not the manifest request(in the screenshot it contains
by adding support for the original website. |
@remitamine |
don't post credentials publically, it's better to change the password. |
@remitamine
Just to remind you, please don't play a video because I can play a video 4 times only. You can get the manifest URL etc, without actually playing any video... it starts loading them automatically. |
I get
Any ideas? |
the manifests served from this website are (partially) encode parts of the Key URL. diff --git a/youtube_dl/downloader/hls.py b/youtube_dl/downloader/hls.py
index b59aad73f..a7b060fd8 100644
--- a/youtube_dl/downloader/hls.py
+++ b/youtube_dl/downloader/hls.py
@@ -13,6 +13,7 @@ from .external import FFmpegFD
from ..compat import (
compat_urllib_error,
+ compat_urllib_parse_unquote,
compat_urlparse,
compat_struct_pack,
)
@@ -184,6 +185,7 @@ class HlsFD(FragmentFD):
if decrypt_info['METHOD'] == 'AES-128':
if 'IV' in decrypt_info:
decrypt_info['IV'] = binascii.unhexlify(decrypt_info['IV'][2:].zfill(32))
+ decrypt_info['URI'] = compat_urllib_parse_unquote(decrypt_info['URI'])
if not re.match(r'^https?://', decrypt_info['URI']):
decrypt_info['URI'] = compat_urlparse.urljoin(
man_url, decrypt_info['URI'])
make sure that you use the Native HLS Downloader:
|
Which file should I put this code in? Would I need to recompile things? I'm somewhat lost... |
you can look up online for how to obtain source code from a git repository, apply a git patch and running the source code with python. |
@remitamine First, kindly confirm whether the steps I performed are correct:
If the above understanding is correct, then please check the associated logs. I'm still getting an error...though, it's different from the earlier one. Also, the command I mentioned in step 4 above doesn't seem to be using the HLS downloader. Youtube-DL is using FFMPEG, which might be the cause of the issue now. Possibly, I'm framing the command in an incorrect manner? |
install PyCrypto or PyCryptodome. |
Hi @remitamine, I installed PyCrypto and downloaded two of those videos. However, I face the following issues:
In the file properties, Windows has mostly blank fields. VLC doesn't even show the duration of the video: Any ideas what's going wrong here? For the malformed aac bitstream, I tried the suggestions on this reddit thread but they didn't work. If it doesn't cause us to deviate from the thread title, your ideas on that too would be invaluable. |
@remitamine The result was: The following caught my eye:
Any advice? Would we be able to make HLS downloader work as earlier, and have the ffmpeg files in the same folder to allow youtube-dl to fix the malformed bitstream? |
PyCrypto missing from executable
possibly similar to #15914. anyway, you have to look for a solution for the problem you have, I'm not here to fix every problem and answer every question(especially when the problem is caused by the website serving partially broken files) |
@remitamine Any suggestions regarding the code to write the output file in decrypted form? |
you have to fix the way to obtain the AES key. and again, I'm not highly interested in this issue. |
Checklist
Question
Please help me diagnose this error log and enlighten me with what I need to do to download the complete video. Any help would be much appreciated!
C:\Users\AAI-Shagun\AppData\Roaming\youtube-dlg>youtube-dl.exe --hls-prefer-native --hls-use-mpegts -v "https://5ad66d227b0c1.streamlock.net/edusecure/_definist/64/1212/5042/121513/64_1212_5042_121513_0.mp4/chunklist_w1422491268.m3u8?isPrimary=true&ref=http%3A%2F%2Ftheiashub.edugyaan.com&sessionId=1l0gahmb2ueads99d190bfcnn4&userId=231644&username=singhal.shagun%40gmail.com&videoId=121513"
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--hls-prefer-native', '--hls-use-mpegts', '-v', 'https://5ad66d227b0c1.streamlock.net/edusecure/_definist/64/1212/5042/121513/64_1212_5042_121513_0.mp4/chunklist_w1422491268.m3u8?isPrimary=true&ref=http%3A%2F%2Ftheiashub.edugyaan.com&sessionId=1l0gahmb2ueads99d190bfcnn4&userId=231644&username=singhal.shagun%40gmail.com&videoId=121513']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2019.07.16
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.14393
[debug] exe versions: ffmpeg 3.2.4, ffprobe 3.2.4, rtmpdump 2.4
[debug] Proxy map: {}
[generic] chunklist_w1422491268.m3u8?isPrimary=true&ref=http://theiashub.edugyaan.com&sessionId=1l0gahmb2ueads99d190bfcnn4&userId=231644&username=singhal.shagun@gmail: Requesting header
[generic] chunklist_w1422491268.m3u8?isPrimary=true&ref=http://theiashub.edugyaan.com&sessionId=1l0gahmb2ueads99d190bfcnn4&userId=231644&username=singhal.shagun@gmail: Downloading m3u8 information
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on 'https://5ad66d227b0c1.streamlock.net/edusecure/_definist/64/1212/5042/121513/64_1212_5042_121513_0.mp4/chunklist_w1422491268.m3u8?isPrimary=true&ref=http%3A%2F%2Ftheiashub.edugyaan.com&sessionId=1l0gahmb2ueads99d190bfcnn4&userId=231644&username=singhal.shagun%40gmail.com&videoId=121513'
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 1016
[download] Destination: chunklist_w1422491268-chunklist_w1422491268.m3u8isPrimary=true&ref=http -theiashub.edugyaan.com&sessionId=1l0gahmb2ueads99d190bfcnn4&userId=231644&username=singhal.shagun@gmail.mp4
[download] 2.7% of ~687.24MiB at Unknown speed ETA Unknown ETATraceback (most recent call last):
File "main.py", line 19, in
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl_init.py", line 474, in main
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl_init.py", line 464, in _real_main
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\YoutubeDL.py", line 2008, in download
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\YoutubeDL.py", line 807, in extract_info
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\YoutubeDL.py", line 861, in process_ie_result
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\YoutubeDL.py", line 1642, in process_video_result
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\YoutubeDL.py", line 1915, in process_info
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\YoutubeDL.py", line 1854, in dl
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\downloader\common.py", line 366, in download
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\downloader\hls.py", line 174, in real_download
File "C:\Python\Python34\lib\site-packages\Crypto\Cipher\AES.py", line 95, in new
File "C:\Python\Python34\lib\site-packages\Crypto\Cipher\AES.py", line 59, in init
File "C:\Python\Python34\lib\site-packages\Crypto\Cipher\blockalgo.py", line 141, in init
ValueError: AES key must be either 16, 24, or 32 bytes long
C:\Users\AAI-Shagun\AppData\Roaming\youtube-dlg>
The text was updated successfully, but these errors were encountered: