From 24acf0e5be876cdf09b72b93ce9a46344ed4dba1 Mon Sep 17 00:00:00 2001 From: RomanPro100 Date: Fri, 31 Jan 2025 19:39:57 +0300 Subject: [PATCH] Fix encoding for m3u links, again --- usr/lib/hypnotix/common.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr/lib/hypnotix/common.py b/usr/lib/hypnotix/common.py index f2c6ac0..9401b4d 100755 --- a/usr/lib/hypnotix/common.py +++ b/usr/lib/hypnotix/common.py @@ -179,7 +179,9 @@ def get_playlist(self, provider, refresh=False) -> bool: # Set stream blocks block_bytes = int(4 * 1024 * 1024) # 4 MB - with open(provider.path, "w", encoding="utf-8") as file: + if response.encoding is None: + response.encoding = response.apparent_encoding + with open(provider.path, "w", encoding=response.encoding) as file: # Grab data by block_bytes for data in response.iter_content(block_bytes, decode_unicode=True): downloaded_bytes += block_bytes