Skip to content

Let's use AI to Earn!

评论抖音

DESKTOP-ZTS2NQJNAcf7c962216d5
diff --git a/electron/main/plat/PlatformBase.ts b/electron/main/plat/PlatformBase.ts
index e786b9c1..f24dcf5c 100644
--- a/electron/main/plat/PlatformBase.ts
+++ b/electron/main/plat/PlatformBase.ts
@@ -146,6 +146,21 @@ export abstract class PlatformBase {
content: string,
): Promise<boolean>;
+
+ /**
+ * 回复评论
+ */
+ abstract replyCommentByOther(
+ account: AccountModel,
+ commentId: string,
+ content: string,
+ option: {
+ dataId?: string; // 作品ID
+ comment: any; // 辅助数据,原数据
+ },
+ ): Promise<any>;
+
+
/**
* 回复评论
*/
diff --git a/electron/main/plat/index.ts b/electron/main/plat/index.ts
index 2e77f608..e7ca68e8 100644
--- a/electron/main/plat/index.ts
+++ b/electron/main/plat/index.ts
@@ -205,6 +205,27 @@ class PlatController {
return await platform.createComment(account, dataId, content);
}
+
+
+ /**
+ * 回复评论
+ * @param account
+ * @param pageInfo
+ */
+ public async replyCommentByOther(
+ account: AccountModel,
+ commentId: string,
+ content: string,
+ option: {
+ dataId?: string; // 作品ID
+ comment: any; // 辅助数据,原数据
+ },
+ ) {
+ const platform = this.platforms.get(account.type)!;
+ return await platform.replyCommentByOther(account, commentId, content, option);
+ }
+
+
/**
* 回复评论
* @param account
diff --git a/electron/main/plat/platforms/douyin/index.ts b/electron/main/plat/platforms/douyin/index.ts
index 951f6606..a60c92bc 100644
--- a/electron/main/plat/platforms/douyin/index.ts
+++ b/electron/main/plat/platforms/douyin/index.ts
@@ -246,6 +246,8 @@ export class Douyin extends PlatformBase {
};
}
+
+ // 其他人作品评论列表
async getCreatorCommentListByOther(
account: AccountModel,
dataId: string,
@@ -291,6 +293,7 @@ export class Douyin extends PlatformBase {
};
}
+
async createComment(
account: AccountModel,
dataId: string, // 作品ID
@@ -306,6 +309,32 @@ export class Douyin extends PlatformBase {
return res.status === 200 && res.data.status_code === 0;
}
+
+ async replyCommentByOther(
+ account: AccountModel,
+ commentId: string,
+ content: string,
+ option: {
+ dataId?: string; // 作品ID
+ comment: any; // 辅助数据,原数据
+ },
+ ) {
+ console.log('------ replyCommentByOther1', commentId, option.dataId);
+
+ const cookie: CookiesType = JSON.parse(account.loginCookie);
+ const res = await douyinService.creatorCommentReplyOther(cookie, {
+ aweme_id: option.dataId || '',
+ reply_id: commentId,
+ text: content,
+ one_level_comment_rank: 1
+ });
+
+ console.log('------ res', res);
+
+ return res;
+ }
+
+
async replyComment(
account: AccountModel,
commentId: string,
diff --git a/electron/main/reply/controller.ts b/electron/main/reply/controller.ts
index 796430b5..bb52766a 100644
--- a/electron/main/reply/controller.ts
+++ b/electron/main/reply/controller.ts
@@ -66,7 +66,7 @@ export class ReplyController {
}
/**
- * 获取评论列表
+ * 获取其他人评论列表
*/
@Icp('ICP_COMMENT_LIST_BY_OTHER')
async getCommentListByOther(
@@ -126,6 +126,32 @@ export class ReplyController {
return res;
}
+ /**
+ * 回复评论
+ */
+ @Icp('ICP_REPLY_COMMENT_BY_OTHER')
+ async replyCommentByOther(
+ event: Electron.IpcMainInvokeEvent,
+ accountId: number,
+ commentId: string,
+ content: string,
+ option: {
+ dataId?: string; // 作品ID
+ comment: any; // 辅助数据,原数据
+ },
+ ): Promise<any> {
+ const account = await this.accountService.getAccountById(accountId);
+ if (!account) return null;
+
+ const res = await platController.replyCommentByOther(
+ account,
+ commentId,
+ content,
+ option,
+ );
+ return res;
+ }
+
/**
* 回复评论
*/
diff --git a/electron/plat/douyin/index.ts b/electron/plat/douyin/index.ts
index 9d7ba5ef..7e6b00b0 100644
--- a/electron/plat/douyin/index.ts
+++ b/electron/plat/douyin/index.ts
@@ -2278,7 +2278,7 @@ export class DouyinService {
},
method: 'GET',
});
-
+ console.log('------ getCreatorItems', res.data.item_info_list[0]);
return res;
}
@@ -2306,7 +2306,7 @@ export class DouyinService {
},
method: 'GET',
});
-
+
return res;
}
@@ -2324,23 +2324,20 @@ export class DouyinService {
// // cursor=20&count=10&
// // a_bogus=mjsjDq7jDpAcFdFb8KEfC5Fl6g6ArTSyNeidWSaTyPY4T1UTpbPUNPb9GxwoA1vPFRBhhH-73VM%2FbDdbO0UwZo9pwmkvuKiRz02C9zmoMHZ3TTv2XNWsCvSELiPTUCsYY%2FA9i2RRXs0KId5WnH9iAp17u%2FvrmRfdMH-XV2TjE9um0ASjhx%2FIa5JBxhwqjD%3D%3D
- let thisUri = `https://www.douyin.com/aweme/v1/web/comment/list/?${jsonToQueryString(
- {
- cursor: pageInfo.cursor || 1,
- count: pageInfo.count || 10,
- aweme_id: item_id,
- a_bogus:
- 'dX0fgqUEY2mfFdKGuOfg743UWS2/Nsuyz-idReZPHOOLT7lGmRPGpPSZbozcYEW5MWB0h937iVllYxdcKsXkZKrpwmhvS/7RsUI998so0qqpT0hDEqfNCwWT9JaT0cwL8CKbJARVUzmc2dA4D1r0UB-JH/Pn4mipQHaWdnUGT9tfgM49PrFxuOtDiXzx5OI41f==',
- },
- )}`;
-
- const res = await requestNet<DouyinHotDataResponse>({
- url: thisUri,
- headers: {
- cookie: CookieToString(cookie),
- },
- method: 'GET',
- });
+ let thisUri = `https://www.douyin.com/aweme/v1/web/comment/list/?${jsonToQueryString({
+ cursor: pageInfo.cursor || 0,
+ count: pageInfo.count || 20,
+ aweme_id: item_id,
+ a_bogus: 'dX0fgqUEY2mfFdKGuOfg743UWS2/Nsuyz-idReZPHOOLT7lGmRPGpPSZbozcYEW5MWB0h937iVllYxdcKsXkZKrpwmhvS/7RsUI998so0qqpT0hDEqfNCwWT9JaT0cwL8CKbJARVUzmc2dA4D1r0UB-JH/Pn4mipQHaWdnUGT9tfgM49PrFxuOtDiXzx5OI41f==',
+ })}`
+
+ const res = await requestNet<DouyinHotDataResponse>({
+ url: thisUri,
+ headers: {
+ cookie: CookieToString(cookie),
+ },
+ method: 'GET',
+ });
console.log('------ getCreatorCommentListByOther', res);
return res;
@@ -2376,6 +2373,39 @@ export class DouyinService {
return res;
}
+ //
+ // 回复其他人的评论
+ async creatorCommentReplyOther(
+ cookie: Electron.Cookie[],
+ data: {
+ aweme_id: string; // 空字符串, 直接回复
+ reply_id: string; // '@j/do779EQE//uctS8rzvvch6oCaTZCH0JqwsPqxpgahhkia+W5A7RJEoPQpq6PZl7wq9uxSqSWCjcIdbPzF8fQ==';
+ text: string; //'哈哈哈';
+ one_level_comment_rank: number; // 3
+ },
+ ) {
+ let thisUri = `https://www.douyin.com/aweme/v1/web/comment/publish/?${jsonToQueryString({
+ aid: '6383'
+ })}`
+ console.log('------ creatorCommentReplyOther-data', data);
+ console.log('------ creatorCommentReplyOther-thisUri', thisUri);
+ const cookieString = CommonUtils.convertCookieToJson(cookie);
+ const csrfToken = await this.getSecsdkCsrfToken(cookieString);
+
+
+ const res = await this.makePublishRequest(thisUri, {
+ method: 'POST',
+ headers: {
+ Cookie: cookieString,
+ 'X-Secsdk-Csrf-Token': csrfToken,
+ 'referer': `https://www.douyin.com/video/${data.aweme_id}`
+ },
+ data: data,
+ });
+ return res;
+ }
+
+
// 作品的评论回复
async creatorCommentReply(
cookie: Electron.Cookie[],
diff --git a/src/icp/replyother.ts b/src/icp/replyother.ts
index d2294cb3..62ff686c 100644
--- a/src/icp/replyother.ts
+++ b/src/icp/replyother.ts
@@ -95,6 +95,31 @@ export async function icpCreateComment(
return res;
}
+
+
+/**
+ * 回复评论
+ */
+export async function icpReplyCommentByOther(
+ accountId: number,
+ commentId: string,
+ content: string,
+ option: {
+ dataId?: string; // 作品ID
+ comment: any; // 辅助数据,原数据
+ },
+) {
+ const res: boolean = await window.ipcRenderer.invoke(
+ 'ICP_REPLY_COMMENT_BY_OTHER',
+ accountId,
+ commentId,
+ content,
+ option,
+ );
+ return res;
+}
+
+
/**
* 回复评论
*/
diff --git a/src/views/reply/components/replyComment.tsx b/src/views/reply/components/replyComment.tsx
index 94d4c366..c46e0d93 100644
--- a/src/views/reply/components/replyComment.tsx
+++ b/src/views/reply/components/replyComment.tsx
@@ -30,7 +30,7 @@ const Com = forwardRef<ReplyCommentRef>((props: any, ref) => {
setIsModalOpen(false);
}
- /**
+ /**
* 回复评论
*/
async function replyComment(content: string) {
diff --git a/src/views/replyother/components/replyComment.tsx b/src/views/replyother/components/replyComment.tsx
index 94d4c366..8e1e3dd0 100644
--- a/src/views/replyother/components/replyComment.tsx
+++ b/src/views/replyother/components/replyComment.tsx
@@ -1,6 +1,6 @@
import { toolsApi } from '@/api/tools';
-import { CommentData, icpReplyComment } from '@/icp/reply';
-import { Button, Form, Input, Modal } from 'antd';
+import { CommentData, icpReplyComment, icpReplyCommentByOther } from '@/icp/replyother';
+import { Button, Form, Input, message, Modal } from 'antd';
import { forwardRef, useImperativeHandle, useState } from 'react';
export interface ReplyCommentRef {
@@ -34,7 +34,7 @@ const Com = forwardRef<ReplyCommentRef>((props: any, ref) => {
* 回复评论
*/
async function replyComment(content: string) {
- const res = await icpReplyComment(
+ const res = await icpReplyCommentByOther(
accountId,
commentData!.commentId,
content,
@@ -43,7 +43,13 @@ const Com = forwardRef<ReplyCommentRef>((props: any, ref) => {
comment: commentData!.data,
},
);
- console.log('----- res', res);
+ // console.log('----- res', res.status_code, res.data);
+ if (res.status_code == 0) {
+ message.success('回复成功');
+ setIsModalOpen(false);
+ } else {
+ message.error('回复失败');
+ }
}
async function onFinish(values: FormData) {
diff --git a/src/views/replyother/components/replyWorks.tsx b/src/views/replyother/components/replyWorks.tsx
index 9bd56f84..3f16dac5 100644
--- a/src/views/replyother/components/replyWorks.tsx
+++ b/src/views/replyother/components/replyWorks.tsx
@@ -23,7 +23,7 @@ const Com = forwardRef<ReplyWorksRef>((props: any, ref) => {
setIsModalOpen(true);
}
- useImperativeHandle(ref, () => ({
+ useImperativeHandle(ref, () => ({
init: init,
}));
@@ -35,7 +35,8 @@ const Com = forwardRef<ReplyWorksRef>((props: any, ref) => {
* 创建评论
*/
async function createComment(content: string) {
- const res = await icpCreateComment(accountId, workData!.dataId, content);
+ console.log('----- createComment', accountId, '7480598266392972596', content);
+ const res = await icpCreateComment(accountId, '7480598266392972596', content);
console.log('----- res', res);
}
diff --git a/src/views/replyother/index.tsx b/src/views/replyother/index.tsx
index aa68e20b..39c3f580 100644
--- a/src/views/replyother/index.tsx
+++ b/src/views/replyother/index.tsx
@@ -45,7 +45,7 @@ export default function Page() {
*/
async function getCommentList(dataId: string) {
// 7483006686274374962 7478960244136086784
- const res = await icpGetCommentListByOther(activeAccountId, '7483006686274374962');
+ const res = await icpGetCommentListByOther(activeAccountId, '7480598266392972596');
console.log('------ icpGetCommentList', res);
setCommentList(res.list);