-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
[downloader/hls] Add support for AES-128 encrypted segments in hlsnative downloader #8201
Conversation
Does it provide the same functionality as #5882? |
i didn't test the branch in the other PR. but from the code it looks like it has the same functionality(except that i didn't change or use aes_cbc_decrypt because the current implementation is too slow when i try to use it the decryption time is more than the download time). |
A side note: PyCrypto + Python 3.5.1 works for the video in #8261 but PyCrypto + Python 2.7.11 produces unplayable files. |
it works for me using PyCrypto + Python 2.7.11(i can play the video there is only a warning from ffmpeg):
|
It works now. I have recently switched between ffmpeg of my build and Arch Linux's official packages. Maybe there's something wrong in my build. |
3c20ec2
to
86e8845
Compare
Could you rebase this PR to master? I'm testing against #9578, but ffmpeg does not work with proxies correctly. |
done. |
frag_content = down.read() | ||
down.close() | ||
if decrypt_info['METHOD'] == 'AES-128': | ||
iv = decrypt_info.get('IV') or struct.pack(">8xq", media_sequence) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use struct_pack
.
done. |
success = ctx['dl'].download(key_filename, {'url': decrypt_info['URI']}) | ||
if not success: | ||
return False | ||
down, key_sanitized = sanitize_open(key_filename, 'rb') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess there's no need to download the key to the dist and read it from the disk. Just urlopen
should be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i did this as an optimization because lots of times the key is the same in the whole manifest with only the change of the IV(and don't download the key every time i resume the download even if the key is a small file) but it looks like this makes the downloading fail for videos that have different keys(found on ooyala).
Just
urlopen
should be fine.
i will use it for now as it will fix the problem with different keys.
done. |
Thanks! |
The pycrypto library is used for HLS streams with encrypted segments. See ytdl-org/youtube-dl#8201
* youtube-dl: add pycryptodome dependency The pycrypto library is used for HLS streams with encrypted segments. See ytdl-org/youtube-dl#8201 * youtube-dl: 2017.05.23 -> 2017.05.29
No description provided.