diff --git a/config/base_config.py b/config/base_config.py index 4236572..fe7d61c 100644 --- a/config/base_config.py +++ b/config/base_config.py @@ -3,8 +3,10 @@ PLATFORM = "xhs" KEYWORDS = "python,golang" LOGIN_TYPE = "qrcode" # qrcode or phone or cookie COOKIES = "" -# 具体值参见media_platform.xxx.field下的枚举值,展示只支持小红书 +# 具体值参见media_platform.xxx.field下的枚举值,暂时只支持小红书 SORT_TYPE = "popularity_descending" +# 具体值参见media_platform.xxx.field下的枚举值,暂时只支持抖音 +PUBLISH_TIME_TYPE = 0 CRAWLER_TYPE = "search" # 爬取类型,search(关键词搜索) | detail(帖子详情)| creator(创作者主页数据) # 是否开启 IP 代理 diff --git a/media_platform/douyin/core.py b/media_platform/douyin/core.py index dde5d5b..33c280c 100644 --- a/media_platform/douyin/core.py +++ b/media_platform/douyin/core.py @@ -91,8 +91,8 @@ class DouYinCrawler(AbstractCrawler): continue try: posts_res = await self.dy_client.search_info_by_keyword(keyword=keyword, - offset=page * dy_limit_count, - publish_time=PublishTimeType.UNLIMITED + offset=page * dy_limit_count - dy_limit_count, + publish_time=PublishTimeType(config.PUBLISH_TIME_TYPE) ) except DataFetchError: utils.logger.error(f"[DouYinCrawler.search] search douyin keyword: {keyword} failed") diff --git a/media_platform/douyin/field.py b/media_platform/douyin/field.py index 0b06b23..ab9da9f 100644 --- a/media_platform/douyin/field.py +++ b/media_platform/douyin/field.py @@ -12,9 +12,8 @@ class SearchChannelType(Enum): class SearchSortType(Enum): """search sort type""" GENERAL = 0 # 综合排序 - LATEST = 1 # 最新发布 - MOST_LIKE = 2 # 最多点赞 - + MOST_LIKE = 1 # 最多点赞 + LATEST = 2 # 最新发布 class PublishTimeType(Enum): """publish time type"""