feat: přidány top odkazy týdne z trends/links API
This commit is contained in:
@@ -125,6 +125,19 @@ def main():
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
top_links = []
|
||||
try:
|
||||
links_data = api_get(f"{base_url}/api/v1/trends/links?limit=3", token)
|
||||
for link in links_data[:3]:
|
||||
top_links.append({
|
||||
"url": link.get("url", ""),
|
||||
"title": link.get("title", ""),
|
||||
"description": link.get("description", ""),
|
||||
"provider_name": link.get("provider_name", ""),
|
||||
})
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
today = datetime.now(timezone.utc).strftime("%Y-%m-%d")
|
||||
os.makedirs("data", exist_ok=True)
|
||||
out_path = os.path.join("data", f"{today}.json")
|
||||
@@ -137,6 +150,7 @@ def main():
|
||||
"newest_account": newest_account,
|
||||
"top": top,
|
||||
"tags": tags,
|
||||
"top_links": top_links,
|
||||
}, f, ensure_ascii=False, indent=2)
|
||||
|
||||
print(f"Uloženo: {out_path} ({len(timeline)} tootů načteno, {len(top)} top, {len(tags)} hashtagů)")
|
||||
|
||||
Reference in New Issue
Block a user