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

@ -123,6 +123,18 @@ class TruthSocialRetriever:
else: else:
posts = data.get("posts", []) 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 = [] results = []
if posts: if posts:
logger.info(f"获取{user_name}帖子: {len(posts)}") logger.info(f"获取{user_name}帖子: {len(posts)}")