Skip to content

Commit

Permalink
Merge pull request #346 from Jasonyang2014/xhs-search-optimization
Browse files Browse the repository at this point in the history
小红书查询没有结果时跳出循环
  • Loading branch information
NanmiCoder authored Jul 18, 2024
2 parents 3f2f03b + 1fd7827 commit 100b8e3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions media_platform/xhs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ async def search(self) -> None:
sort=SearchSortType(config.SORT_TYPE) if config.SORT_TYPE != '' else SearchSortType.GENERAL,
)
utils.logger.info(f"[XiaoHongShuCrawler.search] Search notes res:{notes_res}")
if(not notes_res or not notes_res.get('has_more', False)):
utils.logger.info("No more content!")
break
semaphore = asyncio.Semaphore(config.MAX_CONCURRENCY_NUM)
task_list = [
self.get_note_detail(post_item.get("id"), semaphore)
Expand Down

0 comments on commit 100b8e3

Please sign in to comment.