紧急缺陷修复

This commit is contained in:
MasonLiu committed 2026-05-20 00:40:03 +08:00
1 parent 62d20dacab
commit 514a0131c9
53 files changed
+1265 -1779

No files matched your search

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+12 -3
View File
@@ -21,11 +21,20 @@ def fetch_rss_data(feed_urls, wechat_urls):
'source': source.strip()
}
# 处理 published 字段
if entry_data['published']:
try:
# 尝试解析 published 字段
dt = datetime.strptime(entry_data['published'], '%a, %d %b %Y %H:%M:%S %z')
# 尝试解析 published 字段 - 支持多种日期格式
date_str = entry_data['published']
# 尝试格式1: 'Fri, 05 Aug 2022 14:00:00 +0000' (带时区偏移)
try:
dt = datetime.strptime(date_str, '%a, %d %b %Y %H:%M:%S %z')
except ValueError:
# 尝试格式2: 'Fri, 05 Aug 2022 14:00:00 GMT' (时区缩写)
# 先将 GMT/UTC 替换为 +0000
date_str_fixed = date_str.replace('GMT', '+0000').replace('UTC', '+0000')
dt = datetime.strptime(date_str_fixed, '%a, %d %b %Y %H:%M:%S %z')
dt_china = dt.astimezone(timezone(timedelta(hours=8)))
entry_data['published'] = dt_china.strftime('%Y-%m-%d %H:%M:%S')
except ValueError: