feat: 每日资讯置顶+每列10条+框内滚动

- 资讯移到首页最顶部(精选推荐之上)
- 每列抓取 5→10 条(github/news/ai/it/stock)
- 每列固定240px(恰好5条)超出框内滚动

验证: 顺序正确/10条/固定5条可见/框内滚动 ✓

CHANGELOG记录
This commit is contained in:
personal82555 committed 2026-10-13 16:03:40 +08:00
1 parent cd0264acc2
commit 4d7c398510
3 files changed
+57 -36

No files matched your search

+6 -6
View File
@@ -2532,7 +2532,7 @@ _CST = _tz(_td(hours=8))
_BBC_RSS = "https://feeds.bbci.co.uk/news/world/rss.xml"
_TC_AI_RSS = "https://techcrunch.com/category/artificial-intelligence/feed/"
_HN_RSS = "https://hnrss.org/frontpage"
_STOCK_URL = ("https://push2.eastmoney.com/api/qt/clist/get?pn=1&pz=5&po=1&np=1"
_STOCK_URL = ("https://push2.eastmoney.com/api/qt/clist/get?pn=1&pz=10&po=1&np=1"
"&fltt=2&invt=2&fid=f3&fs=m:0+t:6,m:0+t:80,m:1+t:2,m:1+t:23&fields=f12,f14,f3")
@@ -2564,7 +2564,7 @@ def _http_get(opener, url, timeout=20):
return resp.read()
def _parse_rss(data, limit=5):
def _parse_rss(data, limit=10):
"""RSS 2.0 / Atom -> [{title,url,time}]"""
items = []
try:
@@ -2598,10 +2598,10 @@ def _parse_rss(data, limit=5):
def _fetch_github():
q = (_cst_now() - _td(days=7)).strftime("%Y-%m-%d")
url = f"https://api.github.com/search/repositories?q=created:%3E{q}&sort=stars&order=desc&per_page=5"
url = f"https://api.github.com/search/repositories?q=created:%3E{q}&sort=stars&order=desc&per_page=10"
j = json.loads(_http_get(OPENER_PROXY, url))
out = []
for r in j.get("items", [])[:5]:
for r in j.get("items", [])[:10]:
out.append({
"title": f"{r.get('full_name','')} \u2b50{r.get('stargazers_count',0)}",
"url": r.get("html_url", ""),
@@ -2617,7 +2617,7 @@ def _fetch_stock():
diff = list(diff.values())
today = _cst_now().strftime("%m-%d")
out = []
for r in diff[:5]:
for r in diff[:10]:
name, code, pct = r.get("f14", ""), r.get("f12", ""), r.get("f3", 0)
if not name:
continue
@@ -2673,7 +2673,7 @@ def _fetch_news():
def _col(key, title, icon, fn):
try:
items = (fn() or [])[:5]
items = (fn() or [])[:10]
except Exception as e: # noqa: BLE001
print(f"[news] {key} failed: {e}", flush=True)
items = []