From 6af9d23ee7a0fd081ddbfe00d44a5a379df12695 Mon Sep 17 00:00:00 2001 From: bacon Date: Tue, 4 Mar 2025 00:05:03 +0300 Subject: [PATCH] changed encoding showup --- proxy/rss_proxy.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/proxy/rss_proxy.py b/proxy/rss_proxy.py index d3c8e08..5ea4aec 100755 --- a/proxy/rss_proxy.py +++ b/proxy/rss_proxy.py @@ -27,8 +27,10 @@ def init_proxy(app): # Получаем ленту proxies = {"http": PROXY_URL, "https": PROXY_URL} if PROXY_URL else None r = requests.get(url, timeout=10, proxies=proxies) - r.encoding = "windows-1251" if "windows-1251" in r.headers.get("content-type", "").lower() else r.apparent_encoding - xml_data = r.text.replace('', '') + _encode = r.apparent_encoding.lower() + r.encoding = _encode + xml_data = r.text.replace(f'', + '') # Разбираем XML root = ET.fromstring(xml_data)