fix: 修复抖音中文搜索关键二次编码问题

This commit is contained in:
Relakkes 2024-07-16 01:33:58 +08:00
parent 13ee7bdf95
commit 548271e537
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
# 基础配置
PLATFORM = "xhs"
KEYWORDS = "python,golang"
KEYWORDS = "编程副业,编程兼职"
LOGIN_TYPE = "qrcode" # qrcode or phone or cookie
COOKIES = ""
# 具体值参见media_platform.xxx.field下的枚举值暂时只支持小红书

View File

@ -140,7 +140,7 @@ class DOUYINClient(AbstractApiClient):
query_params = {
'search_channel': search_channel.value,
'enable_history': '1',
'keyword': urllib.parse.quote(keyword),
'keyword': keyword,
'search_source': 'tab_search',
'query_correct_type': '1',
'is_filter_search': '0',
@ -151,10 +151,10 @@ class DOUYINClient(AbstractApiClient):
'list_type': 'multi',
}
if sort_type.value != SearchSortType.GENERAL.value or publish_time.value != PublishTimeType.UNLIMITED.value:
query_params["filter_selected"] = urllib.parse.quote(json.dumps({
query_params["filter_selected"] = json.dumps({
"sort_type": str(sort_type.value),
"publish_time": str(publish_time.value)
}))
})
query_params["is_filter_search"] = 1
query_params["search_source"] = "tab_search"
referer_url = f"https://www.douyin.com/search/{keyword}?aid=f594bbd9-a0e2-4651-9319-ebe3cb6298c1&type=general"