update rss_proxy.py
* testing fixes description
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user