From 0e4abbc44b84091bfc7f359089fb6b2d9b39f5d6 Mon Sep 17 00:00:00 2001 From: bacon Date: Wed, 5 Mar 2025 19:17:33 +0300 Subject: [PATCH] update rss_proxy.py * fixed broken guid rewrite --- proxy/rss_proxy.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/proxy/rss_proxy.py b/proxy/rss_proxy.py index 852d427..2ffcd2f 100755 --- a/proxy/rss_proxy.py +++ b/proxy/rss_proxy.py @@ -1,3 +1,4 @@ +import html import urllib.parse import os import requests @@ -22,8 +23,8 @@ def normalize_text(text): def extract_viewtopic_link(description): - """Ищет любую ссылку в description""" - match = re.search(r'href="(https?://[^"]+)"', description) + decoded_description = html.unescape(description) + match = re.search(r'href="(https?://[^"]+)"', decoded_description) return match.group(1) if match else None @@ -50,13 +51,13 @@ def init_proxy(app): try: proxies = {"http": PROXY_URL, "https": PROXY_URL} if PROXY_URL else None r = requests.get(url, timeout=10, proxies=proxies) - r.encoding = r.apparent_encoding xml_data = r.text xml_data = xml_data.replace("&", "&") + _encoding = xml_data.split('encoding="')[1].split('"')[0] if '', + f'', '' )