globocom / m3u8

Python m3u8 Parser for HTTP Live Streaming (HLS) Transmissions
Other
2.03k stars 471 forks source link

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte #320

Closed wabiloo closed 2 months ago

wabiloo commented 1 year ago

I get this error when doing m3u8.load("https://cdn-vod-1.nxplay.com.br/hls/movies/94934c51-70e8-4583-8fac-2e045529c6d6/media_0.mp4/index-v1-a1.m3u8")

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

Not quite sure why... It seems to be the code in httpclient.py, but can't get my head around it.

davemevans commented 1 year ago

The response is gzip encoded (the 8b in the error message gives it away, but also see the content-encoding header)

urllib doesn't automatically unzip the data, so a patch will be needed that checks the content encoding and passes it through gzip.decompress or similar.

wabiloo commented 1 year ago

I initially thought that might be the issue, but it seemed to work fine with other gzip encoded responses (but I'd have to double check)

mauricioabreu commented 2 months ago

Sorry for the late reply @wabiloo

Working on it