|
|
@@ -479,18 +479,26 @@ class DouyinPublisher(BasePublisher):
|
|
|
|
|
|
# 调用作品列表 API
|
|
|
cursor = page * page_size
|
|
|
- api_url = f"https://creator.douyin.com/janus/douyin/creator/pc/work_list?status=0&scene=star_atlas&device_platform=android&count={page_size}&max_cursor={cursor}&cookie_enabled=true&browser_language=zh-CN&browser_platform=Win32&browser_name=Mozilla&browser_online=true&timezone_name=Asia%2FShanghai&aid=1128"
|
|
|
+ # 移除 scene=star_atlas 和 aid=1128,使用更通用的参数
|
|
|
+ api_url = f"https://creator.douyin.com/janus/douyin/creator/pc/work_list?status=0&device_platform=android&count={page_size}&max_cursor={cursor}&cookie_enabled=true&browser_language=zh-CN&browser_platform=Win32&browser_name=Mozilla&browser_online=true&timezone_name=Asia%2FShanghai"
|
|
|
|
|
|
response = await self.page.evaluate(f'''
|
|
|
async () => {{
|
|
|
- const resp = await fetch("{api_url}", {{
|
|
|
- credentials: 'include',
|
|
|
- headers: {{ 'Accept': 'application/json' }}
|
|
|
- }});
|
|
|
- return await resp.json();
|
|
|
+ try {{
|
|
|
+ const resp = await fetch("{api_url}", {{
|
|
|
+ credentials: 'include',
|
|
|
+ headers: {{ 'Accept': 'application/json' }}
|
|
|
+ }});
|
|
|
+ return await resp.json();
|
|
|
+ }} catch (e) {{
|
|
|
+ return {{ error: e.toString() }};
|
|
|
+ }}
|
|
|
}}
|
|
|
''')
|
|
|
|
|
|
+ if response.get('error'):
|
|
|
+ print(f"[{self.platform_name}] API 请求失败: {response.get('error')}", flush=True)
|
|
|
+
|
|
|
print(f"[{self.platform_name}] API 响应: has_more={response.get('has_more')}, aweme_list={len(response.get('aweme_list', []))}")
|
|
|
|
|
|
aweme_list = response.get('aweme_list', [])
|
|
|
@@ -502,6 +510,8 @@ class DouyinPublisher(BasePublisher):
|
|
|
continue
|
|
|
|
|
|
statistics = aweme.get('statistics', {})
|
|
|
+ # 打印调试信息,确认字段存在
|
|
|
+ # print(f"[{self.platform_name}] 作品 {aweme_id} 统计: {statistics}", flush=True)
|
|
|
|
|
|
# 获取封面
|
|
|
cover_url = ''
|