🐛 修复资源发布时间时区错误问题 (#114)
Some checks are pending
Docker Publish / build-and-push (push) Waiting to run

This commit is contained in:
xiaoQQya 2025-08-22 21:08:50 +08:00 committed by GitHub
parent de37c26423
commit 6f9b009194
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,4 @@
import datetime
from datetime import datetime, timedelta
import re
import requests
@ -128,7 +128,8 @@ class CloudSaver:
# 统一发布时间格式
pubdate = item.get("pubDate", "")
if pubdate:
pubdate = datetime.datetime.strptime(pubdate, "%Y-%m-%dT%H:%M:%S%z").strftime("%Y-%m-%d %H:%M:%S")
utc_tm = datetime.fromisoformat(pubdate)
pubdate = (utc_tm + timedelta(hours=8)).strftime("%Y-%m-%d %H:%M:%S")
# 链接去重
if link.get("link") not in link_array:
link_array.append(link.get("link"))

View File

@ -1,5 +1,5 @@
import re
import datetime
from datetime import datetime, timedelta
import requests
@ -60,7 +60,8 @@ class PanSou:
note = channel.get("note", "")
tm = channel.get("datetime", "")
if tm:
tm = datetime.datetime.strptime(tm, "%Y-%m-%dT%H:%M:%SZ").strftime("%Y-%m-%d %H:%M:%S")
utc_tm = datetime.strptime(tm, "%Y-%m-%dT%H:%M:%SZ")
tm = (utc_tm + timedelta(hours=8)).strftime("%Y-%m-%d %H:%M:%S")
match = re.search(pattern, note)
if match: