feat: base_config 增加抖音发布时间配置
fix: 抖音排序类型枚举值 fix: 抖音offset计算问题
This commit is contained in:
parent
bea9193405
commit
6080c22a3d
|
@ -3,8 +3,10 @@ PLATFORM = "xhs"
|
||||||
KEYWORDS = "python,golang"
|
KEYWORDS = "python,golang"
|
||||||
LOGIN_TYPE = "qrcode" # qrcode or phone or cookie
|
LOGIN_TYPE = "qrcode" # qrcode or phone or cookie
|
||||||
COOKIES = ""
|
COOKIES = ""
|
||||||
# 具体值参见media_platform.xxx.field下的枚举值,展示只支持小红书
|
# 具体值参见media_platform.xxx.field下的枚举值,暂时只支持小红书
|
||||||
SORT_TYPE = "popularity_descending"
|
SORT_TYPE = "popularity_descending"
|
||||||
|
# 具体值参见media_platform.xxx.field下的枚举值,暂时只支持抖音
|
||||||
|
PUBLISH_TIME_TYPE = 0
|
||||||
CRAWLER_TYPE = "search" # 爬取类型,search(关键词搜索) | detail(帖子详情)| creator(创作者主页数据)
|
CRAWLER_TYPE = "search" # 爬取类型,search(关键词搜索) | detail(帖子详情)| creator(创作者主页数据)
|
||||||
|
|
||||||
# 是否开启 IP 代理
|
# 是否开启 IP 代理
|
||||||
|
|
|
@ -91,8 +91,8 @@ class DouYinCrawler(AbstractCrawler):
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
posts_res = await self.dy_client.search_info_by_keyword(keyword=keyword,
|
posts_res = await self.dy_client.search_info_by_keyword(keyword=keyword,
|
||||||
offset=page * dy_limit_count,
|
offset=page * dy_limit_count - dy_limit_count,
|
||||||
publish_time=PublishTimeType.UNLIMITED
|
publish_time=PublishTimeType(config.PUBLISH_TIME_TYPE)
|
||||||
)
|
)
|
||||||
except DataFetchError:
|
except DataFetchError:
|
||||||
utils.logger.error(f"[DouYinCrawler.search] search douyin keyword: {keyword} failed")
|
utils.logger.error(f"[DouYinCrawler.search] search douyin keyword: {keyword} failed")
|
||||||
|
|
|
@ -12,9 +12,8 @@ class SearchChannelType(Enum):
|
||||||
class SearchSortType(Enum):
|
class SearchSortType(Enum):
|
||||||
"""search sort type"""
|
"""search sort type"""
|
||||||
GENERAL = 0 # 综合排序
|
GENERAL = 0 # 综合排序
|
||||||
LATEST = 1 # 最新发布
|
MOST_LIKE = 1 # 最多点赞
|
||||||
MOST_LIKE = 2 # 最多点赞
|
LATEST = 2 # 最新发布
|
||||||
|
|
||||||
|
|
||||||
class PublishTimeType(Enum):
|
class PublishTimeType(Enum):
|
||||||
"""publish time type"""
|
"""publish time type"""
|
||||||
|
|
Loading…
Reference in New Issue