Skip to content

Let's use AI to Earn!

fix: 修复抖音获取回复列表

yikaJasonMic1d6759676eb6
diff --git a/electron/main/plat/platforms/douyin/index.ts b/electron/main/plat/platforms/douyin/index.ts
index f4c10b69..310f5a96 100644
--- a/electron/main/plat/platforms/douyin/index.ts
+++ b/electron/main/plat/platforms/douyin/index.ts
@@ -1,7 +1,7 @@
/*
* @Author: nevin
* @Date: 2025-02-08 11:40:45
- * @LastEditTime: 2025-03-22 17:55:12
+ * @LastEditTime: 2025-03-23 22:45:39
* @LastEditors: nevin
* @Description: 抖音
*/
@@ -200,20 +200,21 @@ export class Douyin extends PlatformBase {
const res2 = await douyinService.getCreatorCommentReplyList(
cookie,
v.comment_id,
- dataId,
{
cursor: 0 + '',
count: 20,
},
);
+
if (res2.status === 200 && res2.data.status_code === 0) {
- for (const element of res2.data.comments) {
+ for (const element of res2.data.comment_info_list) {
subList.push({
dataId: dataId,
- commentId: element.cid,
+ commentId: element.comment_id,
content: element.text,
- nikeName: element.user.nickname,
- headUrl: element.user.avatar_thumb.url_list[0] || '',
+ likeCount: Number.parseInt(element.digg_count),
+ nikeName: element.user_info.screen_name,
+ headUrl: element.user_info.avatar_url,
data: element,
subCommentList: [],
});
diff --git a/electron/main/reply/controller.ts b/electron/main/reply/controller.ts
index 3e043a3d..b7d4eca5 100644
--- a/electron/main/reply/controller.ts
+++ b/electron/main/reply/controller.ts
@@ -1,7 +1,7 @@
/*
* @Author: nevin
* @Date: 2025-01-20 22:02:54
- * @LastEditTime: 2025-03-23 19:43:47
+ * @LastEditTime: 2025-03-23 21:53:31
* @LastEditors: nevin
* @Description: reply Reply
*/
@@ -102,9 +102,7 @@ export class ReplyController {
status: -1 | 0 | 1;
error?: any;
}) => {
- console.log(e);
- // TODO: 推送消息
- windowOperate.sendRenderMsg(SendChannelEnum.CommentRelyProgress, 111);
+ windowOperate.sendRenderMsg(SendChannelEnum.CommentRelyProgress, e);
},
);
diff --git a/electron/plat/douyin/index.ts b/electron/plat/douyin/index.ts
index 3e7f7132..27da4a4c 100644
--- a/electron/plat/douyin/index.ts
+++ b/electron/plat/douyin/index.ts
@@ -2315,27 +2315,32 @@ export class DouyinService {
async getCreatorCommentReplyList(
cookie: Electron.Cookie[],
comment_id: string, // 评论ID
- item_id: string, // 作品ID
pageInfo: {
cursor?: string;
count?: number;
+ } = {
+ cursor: '0',
+ count: 10,
},
) {
- const res = await requestNet<DouyinCommentReplyListResponse>({
+ const cookieString = CommonUtils.convertCookieToJson(cookie);
+ const csrfToken = await this.getSecsdkCsrfToken(cookieString);
+
+ console.log('----- comment_id', comment_id);
+ console.log('----- pageInfo', pageInfo);
+
+ const res = await requestNet<DouyinCreatorCommentListResponse>({
url: CommonUtils.buildUrl(
- `https://creator.douyin.com/web/api/third_party/aweme/api/comment/read/aweme/v1/web/comment/list/reply/`, // msToken=xxx
+ `https://creator.douyin.com/aweme/v1/creator/comment/reply/list/`, // msToken=xxx
{
+ comment_id: comment_id,
cursor: pageInfo.cursor,
count: pageInfo.count,
- comment_id: comment_id,
- item_id: item_id,
- app_id: 2906,
- aid: 2906,
- device_platform: 'webapp',
},
),
headers: {
- cookie: CookieToString(cookie),
+ cookie: cookieString,
+ 'X-Secsdk-Csrf-Token': csrfToken,
},
method: 'GET',
});
diff --git a/src/views/reply/index.tsx b/src/views/reply/index.tsx
index 046e6f92..7c45f47a 100644
--- a/src/views/reply/index.tsx
+++ b/src/views/reply/index.tsx
@@ -1,7 +1,7 @@
/*
* @Author: nevin
* @Date: 2025-02-10 22:20:15
- * @LastEditTime: 2025-03-23 19:39:40
+ * @LastEditTime: 2025-03-23 21:52:31
* @LastEditors: nevin
* @Description: 评论页面 reply
*/
@@ -12,7 +12,7 @@ import {
CommentData,
icpCreateCommentList,
} from '@/icp/reply';
-import { Avatar, Button, Card, Col, Row } from 'antd';
+import { Avatar, Button, Card, Col, message, Row } from 'antd';
import { useCallback, useRef, useState } from 'react';
import AccountSidebar from '../account/components/AccountSidebar/AccountSidebar';
import styles from './reply.module.scss';
@@ -33,7 +33,7 @@ export default function Page() {
// 注册监听
(() => {
window.ipcRenderer.on(SendChannelEnum.CommentRelyProgress, (e, args) => {
- console.log('--------- e', e);
+ message.info('收到评论通知');
console.log('--------- args', args);
});
})();