From 2dce4609f66efa998053696f4c7c087db78a59c1 Mon Sep 17 00:00:00 2001 From: bacon Date: Wed, 5 Mar 2025 20:11:15 +0300 Subject: [PATCH] update rss_proxy.py * testing fixes description --- proxy/rss_proxy.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proxy/rss_proxy.py b/proxy/rss_proxy.py index abef01a..596bb0a 100755 --- a/proxy/rss_proxy.py +++ b/proxy/rss_proxy.py @@ -73,6 +73,7 @@ def init_proxy(app): root = ET.fromstring(xml_data) items = root.findall(".//item") + cached_items = [] new_items = [] @@ -84,6 +85,8 @@ def init_proxy(app): cache_key = f"rss:item:{guid.text}" cached_item = rdb.get(cache_key) + title = item.find("title") + title.text = re.sub(r'&#\d+;', '', title.text) if cached_item: cached_items.append(cached_item.decode()) @@ -99,9 +102,6 @@ def init_proxy(app): # 🔹 Теперь нормализуем весь item ПОСЛЕ замены guid normalize_xml_texts(item) - title = item.find("title") - - title.text = re.sub(r'&#\d+;', '', title.text) item_str = ET.tostring(item, encoding="unicode") item_str = html.unescape(item_str) rdb.setex(cache_key, CACHE_TTL, item_str)