修正北京时间并更换新闻候选源
This commit is contained in:
@@ -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")))
|
||||
|
||||
Reference in New Issue
Block a user