From fb90192254f3e601d5e857a675a8e31011b50ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=B8=96=E9=BE=99?= <1261586682@qq.com> Date: Tue, 13 Aug 2024 08:59:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B7=98=E5=AE=9D=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api/taobao/taobao.md | 2 ++ service/taobao/logic/search.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/api/taobao/taobao.md b/docs/api/taobao/taobao.md index 6a7b5bf..9916893 100644 --- a/docs/api/taobao/taobao.md +++ b/docs/api/taobao/taobao.md @@ -132,6 +132,8 @@ | 参数 | 必选 | 类型 | 说明 | |:---:|:---:|:---:|:---:| | id | true | string | 商品id | +| offset | false | int | 评论翻页偏移量, 默认0 | +| limit | false | int | 评论数量, 默认20 | - **Success Response** diff --git a/service/taobao/logic/search.py b/service/taobao/logic/search.py index 194901e..97ebb52 100644 --- a/service/taobao/logic/search.py +++ b/service/taobao/logic/search.py @@ -18,8 +18,8 @@ async def request_search(keyword: str, cookie: str, offset: int = 0, limit: int total = 0 tasks = [search(keyword, cookie, page) for page in range(start_page, end_page + 1)] - results = await asyncio.gather(*tasks) - for data in results: + task_results = await asyncio.gather(*tasks) + for data in task_results: results.extend(data.get('itemsArray', [])) total = data.get('mainInfo', {}).get('totalResults', 0)