修正北京时间并更换新闻候选源

This commit is contained in:
Codex
2026-07-08 23:08:55 +08:00
parent 3ece2327c8
commit 88e1cf4b7a
10 changed files with 178 additions and 55 deletions
+3 -2
View File
@@ -9,6 +9,7 @@ from urllib.parse import urlencode
from urllib.request import Request, urlopen
from app.core.config import Settings
from app.core.timezone import to_beijing_naive
from app.schemas.agent import SignalItem
logger = logging.getLogger(__name__)
@@ -110,7 +111,7 @@ class GitHubHotProjectClient:
return stars * 3 + forks + recency_bonus
def _parse_datetime(self, value: Any) -> Optional[datetime]:
# GitHub时间戳使用UTC ISO格式和Z后缀。
# GitHub时间戳使用UTC ISO格式和Z后缀,入库前先换算为北京时间
if not isinstance(value, str):
return None
return datetime.fromisoformat(value.replace("Z", "+00:00")).replace(tzinfo=None)
return to_beijing_naive(datetime.fromisoformat(value.replace("Z", "+00:00")))