Hi everybody,
I'm trying to download a video from a website wich uses hls stream protocol. I managed to get the playlist file and all the ts files, but when I try to concatenate them with ffmpeg, it doesn't works obviously.
In the playlist file, there a URI link to the key:
#EXT-X-KEY:METHOD=AES-128,URI="link to the key",IV=0x3838c5776a2114c7233d9099fb7d7bf2
There's a python script on the forum (Here (http://stream-recorder.com/forum/decrypt-aes-128-encrypted-video-files-m3u8-t18317p3.html)) but when I execute it, it says to me this error:
AttributeError: 'M3U8' object has no attribute 'key'
The key given by the website is a 16 bytes incomprehensible word :
D×><
AiB?a±?U<Á
If you want more information about the website, send me a pm, I'm trying not to get the attention from them.
Thanks!
vanminhland87
10-26-2017, 10:36 AM
Dá»± ??n cao cá??p quá?*n 9 Rio Vista (http://muachungcusg.com/du-an-cao-cap-quan-9-rio-vista-dang-cap.html)nh?* phố v?* biệt thá»± l?* dá»± ??n nh?* á»? cao cá??p cá»§a tá?*p Ä‘o?*n MIK Group. Ná?±m tá??i Khu biệt thá»± Khang Ä?iá»?n, ph?°á»?ng Ph?°á»›c Long B, quá?*n 9, Tp.HCM. Rio Vista l?* niá»?m tá»± h?*o tiá??p theo cá»§a MIK Group sau nhá»?ng dá»± ??n Ä‘?¬nh Ä‘??m tr?°á»›c Ä‘?? bao gồm: Villa Park quá?*n 9, Park Riverside, Park Riverside Premium & River Park.
http://muachungcusg.com/wp-content/uploads/2017/10/tong-the-rio-vista-e1508079028898.jpg
T??n dá»± ??n: Khu d??n c?° cao cá??p Rio Vista Quá?*n 9
Chá»§ Ä‘á?§u t?°: Tá?*p Ä?o?*n MIK GROUP
Quy m?´: 4.8 ha vá»›i số l?°á»?ng nh?* phố 234 cÄ?n v?* diện t?*ch má??ng xanh & tiện ?*ch ná»™i khu: 1 ha
Loá??i h?¬nh nh?* á»?: nh?* á»?, nh?* phố th?°??ng má??i v?* biệt thá»±.
B?*n giao: Ho?*n thiện ngo?*i s� h�u sổ hồng vĩnh viễn v?* b?*n giao :4/2018
http://muachungcusg.com/wp-content/uploads/2017/10/vi-tri-rio-vista-e1508079161871.jpg
Dá»± ??n Rio Vista ná?±m tr??n Ä‘?°á»?ng D?°??ng Ä??¬nh Há»™i, Ph?°á»?ng Ph?°á»›c Long B, Quá?*n 9,TPHCM . Dá»± ??n ná?±m gá?§n khu biệt thá»± Gia H??a, khu Khang Ä?iá»?n, khu biệt thá»± Valora Nam Long .
Dá»± ??n cÄ?n há»™ Rio Vista (http://muachungcusg.com/du-an-cao-cap-quan-9-rio-vista-dang-cap.html) vá»›i nhiá»?u chức nÄ?ng nhá?±m Ä‘??p ứng nhu cá?§u cá»§a cuá»™c sống hiện Ä‘á??i v?* tiá??t kiệm tối Ä‘a thá»?i gian Ä‘i lá??i v?* nghỉ ng??i cá»§a c?° d??n m?* kh?´ng phá??i cá?§n Ä‘i Ä‘??u xa. Khu trung t??m th?°??ng má??i mua sá??m rá»™ng lá»›n Ä‘á?§y đủ tiện ?*ch khu c?´ng vi??n, c?? nhiá»?u má??ng xanh gi??p cho kh??ch h?*ng c?? nhá»?ng gi??y ph??t th?° giá??n tuyệt vá»?i b??n gia Ä‘?¬nh cafe sang trá»?ng v?* dịch vá»? chÄ?m s??c sức khá»?e: gym, spa… Ph??ng sinh hoá??t cá»™ng đồng dịch vá»? bá??o vệ chuy??n nghiệp 24/24 an ninh tuyệt đối, khu vui ch??i cho trá?» em, BBQ ngo?*i trá»?i cho cá?? gia Ä‘?¬nh ….
Gi?? b??n dá»± kiá??n nh?* phố Rio Vista : (Xem cÄ?n há»™ thá»±c tá?? (http://muachungcusg.com/nha-mau-du-rio-vista))
– Nh?* phố Rio Vista: 5?—15 – Gi?? 3,1 – 3,3 tá»·/cÄ?n (Ä??? VAT) ,
– Biệt thá»± g??c Rio Vista – Gi?? 5 – 7 tá»·/cÄ?n (Ä??? VAT) ,
– Shophouse Rio Vista : 5?—20 – Gi?? 4,5 – 5 tá»·/cÄ?n (Ä??? VAT)
>>>Gá»?i ngay Ä‘á»? nhá?*n ngay bá??ng gi?? ?°u Ä‘??i<<<Chá»§ Ä?á?§u T?° Hotline :0911.3433.22
Yes but the key looks very weird, don't you think? There' no extension in the key url and it looks like this:
https://image.ibb.co/nosmAm/key.png
So if I understand right, the hexadecimal converted key should looks like this:
44c3973e3cda416942c2a361c2b1c3a03553cc381
Using the script available on the forum, I use the key and the iv directly because for some reason the m3u8 library doesn't work for me:
import m3u8
from Crypto.Cipher import AES
f = open('file.ts','rb')
playlist = m3u8.loads(playlist)
key = '44c3973e3cda416942c2a361c2b1c3a03553cc381'
iv = '3838c5776a2114c7233d9099fb7d7bf2' # For the iv I guess I didn't have to put '0x' in front of it.
aes = AES.new(key, AES.MODE_CBC, iv)
for x in playlist.segments :
r = urllib2.urlopen(x.uri)
d = r.read()
d = aes.decrypt(d)
f.write(d)
f.close()
When executing the script, I got this error:
ValueError: AES must be either 16, 24, or 32 bytes long
I guess I've done something wrong with the key.
Thanks for your time!
I've tried this way, but there's still a problem with the key. ffmpeg says "Invalid data found when processing output". You can see here (https://stackoverflow.com/questions/34235397/decrypting-and-combining-ts-audio-files-with-m3u8) that they had the same problem (comments at the end).
I've uploaded the key files I'm using, the thing is that I don't know what's wrong in it.
Thanks
There's a thread on this forum that was dealing about the same thing (Here (http://stream-recorder.com/forum/download-key-protected-m3u8-t22640.html)).
I had to use Fiddler to intercept and download the key, and then use ffmpeg with the playlist file as input.
JonDough
10-29-2017, 04:39 PM
There's a thread on this forum that was dealing about the same thing (Here (http://stream-recorder.com/forum/download-key-protected-m3u8-t22640.html)).
I had to use Fiddler to intercept and download the key, and then use ffmpeg with the playlist file as input.
Thanks for your assistance with this! The difference here is that the key is fetched over https, unlike the site in that forum thread.
vBulletin® , Copyright ©2000-2025, Jelsoft Enterprises Ltd.