From 96edc6715abf588b70e737ebac6aedc12d6441a7 Mon Sep 17 00:00:00 2001 From: Osamaali313 Date: Sun, 19 Jul 2026 22:39:31 +0300 Subject: [PATCH] Fix get_hot_posts ignoring the limit parameter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `XueqiuChannel.get_hot_posts(limit)` documents `limit: 最多返回条数(上限 50)`, but the request hard-codes the page size to `count=20`: "?since_id=-1&max_id=-1&count=20&category=-1" so the server never returns more than 20 posts. The subsequent `items[:limit]` slice can only shrink those 20 — it can never reach the documented maximum of 50. `get_hot_posts(limit=50)` silently returns 20. The two sibling methods in the same file thread `limit` into the page-size param: `search_stock` uses `&size={limit}` and `get_hot_stocks` uses `?size={limit}`. Do the same here so the requested count is honored. --- agent_reach/channels/xueqiu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent_reach/channels/xueqiu.py b/agent_reach/channels/xueqiu.py index c5bc528d..63cb2ae3 100644 --- a/agent_reach/channels/xueqiu.py +++ b/agent_reach/channels/xueqiu.py @@ -259,7 +259,7 @@ def get_hot_posts(self, limit: int = 20) -> list: """ data = _get_json( "https://xueqiu.com/v4/statuses/public_timeline_by_category.json" - "?since_id=-1&max_id=-1&count=20&category=-1" + f"?since_id=-1&max_id=-1&count={limit}&category=-1" ) items = data.get("list") or [] results = []