support get more articles

This commit is contained in:
blade 2025-10-28 17:30:30 +08:00
parent ce10e4fbf2
commit 69dc818c73
2 changed files with 12 additions and 0 deletions

View File

@ -122,6 +122,18 @@ class TruthSocialRetriever:
posts = data.get("posts", [])[:limit]
else:
posts = data.get("posts", [])
if len(posts) == 1:
try:
max_id = posts[0].get("id")
params["next_max_id"] = max_id
response = requests.get(base_url, headers=headers, params=params)
response.raise_for_status() # 检查 HTTP 错误
data = response.json()
posts.extend(data.get("posts", []))
except Exception as e:
logger.error(f"获取下一页帖子失败: {e}")
pass
results = []
if posts: