hls-downloader
hls-downloader copied to clipboard
Downloaded video is unavailable that with AES-128 but no IV
Describe the bug On a certain website, detect and download its media. Only unencrypted head can be played, the encrypted part is not playable.
To Reproduce
Sorry, the site is private.
#EXT-X-KEY:METHOD=AES-128,URI="/path/key.key"
in second m3u8.
Expected behavior Decrypt data with the correct parameters.
https://github.com/HeiSir2014/M3U8-Downloader support this case.
Screenshots N/A
Desktop (please complete the following information):
- OS: Windows 10
- Browser: Firefox & Edge
- Version: latest
Additional context
https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-02#section-5.2
An EXT-X-KEY tag with a KEYFORMAT of "identity" that does not have an IV attribute indicates that the Media Sequence Number is to be used as the IV when decrypting a Media Segment, by putting its big-endian binary representation into a 16-octet (128-bit) buffer and padding (on the left) with zeros.
But our code seems to accept the raw data if IV is not provided. https://github.com/puemos/hls-downloader/blob/191653b641a823cde7d5a30bc7d9670fb7adc703/src/core/src/use-cases/decrypt-single-fragment.ts#L13
I have a similar issue. I downloaded the video from this website. ( https://dizipal430.com/dizi/konusanlar/sezon-3/bolum-11 ) But it doesn't open the video with any player. (Vlc, Pot, etc) . I think it's because of hls encryption.