Skip to content

Let's use AI to Earn!

评论还需要回传作者id 需要处理

DESKTOP-ZTS2NQJNA2e7ba74efda2
diff --git a/electron/main/plat/PlatformBase.ts b/electron/main/plat/PlatformBase.ts
index 447215e4..813d4b3d 100644
--- a/electron/main/plat/PlatformBase.ts
+++ b/electron/main/plat/PlatformBase.ts
@@ -83,7 +83,8 @@ export abstract class PlatformBase {
*/
abstract dianzanDyOther(
account: AccountModel,
- pcursor?: string,
+ dataId: string,
+ option?: any,
): Promise<any>;
/**
diff --git a/electron/main/plat/index.ts b/electron/main/plat/index.ts
index 40900488..15285c7f 100644
--- a/electron/main/plat/index.ts
+++ b/electron/main/plat/index.ts
@@ -182,9 +182,9 @@ class PlatController {
* @param account
* @param pcursor
*/
- public async dianzanDyOther(account: AccountModel, pcursor?: string) {
+ public async dianzanDyOther(account: AccountModel, dataId: string, option?: any) {
const platform = this.platforms.get(account.type)!;
- return await platform.dianzanDyOther(account, pcursor);
+ return await platform.dianzanDyOther(account, dataId, option);
}
/**
diff --git a/electron/main/plat/platforms/Kwai/index.ts b/electron/main/plat/platforms/Kwai/index.ts
index d4b552aa..d4a82ebe 100644
--- a/electron/main/plat/platforms/Kwai/index.ts
+++ b/electron/main/plat/platforms/Kwai/index.ts
@@ -369,14 +369,21 @@ export class Kwai extends PlatformBase {
return new Promise((resolve, reject) => {});
}
+
+ // 创建其他视频评论
async createCommentByOther(
account: AccountModel,
dataId: string, // 作品ID
content: string,
) {
- return null;
+ const cookie: CookiesType = JSON.parse(account.loginCookie);
+ const res = await kwaiPub.videoCommentByOther(cookie, dataId, content);
+ console.log('------ kaishou createComment res ----', res);
+
+ return res.data;
}
+ // 回复其他评论
async replyCommentByOther(
account: AccountModel,
commentId: string,
@@ -386,7 +393,18 @@ export class Kwai extends PlatformBase {
comment: any; // 辅助数据,原数据
},
) {
- return null;
+ const cookie: CookiesType = JSON.parse(account.loginCookie);
+
+ const res = await kwaiPub.commentAdd(cookie, content, {
+ photoId: option.dataId,
+ replyToCommentId: Number.parseInt(commentId),
+ replyTo: option.comment.authorId,
+ });
+
+ console.log('------ replyCommentByOther res ----', res);
+
+ if (res.status !== 200 || res.data.result !== 1) return false;
+ return false;
}
async createComment(
@@ -500,8 +518,11 @@ export class Kwai extends PlatformBase {
/**
* 点赞
*/
- dianzanDyOther(account: AccountModel, pcursor?: string): Promise<any> {
- return new Promise((resolve, reject) => {});
+ async dianzanDyOther(account: AccountModel, dataId: string, option?: any): Promise<any> {
+ const cookie: CookiesType = JSON.parse(account.loginCookie);
+ const res = await kwaiPub.dianzanDyOther(cookie, dataId, option);
+ console.log('------ dianzanDyOther -- Kwai --- res: ', res);
+ return res.data;
}
/**
diff --git a/electron/main/reply/controller.ts b/electron/main/reply/controller.ts
index 81b6e4d6..ca122d63 100644
--- a/electron/main/reply/controller.ts
+++ b/electron/main/reply/controller.ts
@@ -34,7 +34,8 @@ export class ReplyController {
async dianzanDyOther(
event: Electron.IpcMainInvokeEvent,
accountId: number,
- pcursor?: string,
+ dataId: string,
+ option?: any,
) {
const account = await this.accountService.getAccountById(accountId);
@@ -44,7 +45,7 @@ export class ReplyController {
count: 0,
};
- const res = await platController.dianzanDyOther(account, pcursor);
+ const res = await platController.dianzanDyOther(account, dataId, option);
return res;
}
diff --git a/electron/plat/Kwai/index.ts b/electron/plat/Kwai/index.ts
index ccdfd499..4192669a 100644
--- a/electron/plat/Kwai/index.ts
+++ b/electron/plat/Kwai/index.ts
@@ -526,6 +526,86 @@ class KwaiPub {
return res;
}
+
+
+ /**
+ * 点赞
+ * @param cookie
+ * @param photoId
+ * @param content
+ * @param reply
+ * @returns
+ */
+ async dianzanDyOther(
+ cookie: Electron.Cookie[],
+ dataId: string,
+ option: any,
+ ) {
+ const res = await this.requestApi<CommentAddResponse>({
+ cookie: cookie,
+ apiUrl: 'https://www.kuaishou.com/graphql',
+ method: 'POST',
+ body: {
+ "operationName":"visionVideoLike",
+ "variables":{"photoId": dataId,"photoAuthorId":"3xg4kz5yqa2ce2c","cancel":0,"expTag":"1_i/2008189535617610417_xpcwebdetailxxnull0"},
+ "query": `mutation visionVideoLike($photoId: String, $photoAuthorId: String, $cancel: Int, $expTag: String) {\n visionVideoLike(photoId: $photoId, photoAuthorId: $photoAuthorId, cancel: $cancel, expTag: $expTag) {\n result\n __typename\n }\n}\n`
+ },
+ headers: {
+ Referer: `https://www.kuaishou.com/short-video/${dataId}`,
+ 'User-Agent':
+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36',
+ },
+ });
+
+ console.log('---- douyin commentAdd ----', res);
+
+ return res;
+ }
+
+ /**
+ * 视频评论
+ * @param cookie
+ * @param photoId
+ * @param content
+ * @param reply
+ * @returns
+ */
+ async videoCommentByOther(
+ cookie: Electron.Cookie[],
+ dataId: string,
+ content: string,
+ ) {
+ const res = await this.requestApi<CommentAddResponse>({
+ cookie: cookie,
+ apiUrl: 'https://www.kuaishou.com/graphql',
+ method: 'POST',
+ body: {"operationName":"visionAddComment",
+ "variables":{
+ "photoId":'3xxdnfeyyjp2qck',
+ "photoAuthorId":"3xya6h9q3j26d2g",
+ "content":content,
+ "expTag":"1_a/2004436422502146722_xpcwebdetailxxnull0"},
+ "query":"mutation visionAddComment($photoId: String, $photoAuthorId: String, $content: String, $replyToCommentId: ID, $replyTo: ID, $expTag: String) {\n visionAddComment(photoId: $photoId, photoAuthorId: $photoAuthorId, content: $content, replyToCommentId: $replyToCommentId, replyTo: $replyTo, expTag: $expTag) {\n result\n commentId\n content\n timestamp\n status\n __typename\n }\n}\n"},
+ headers: {
+ Referer: `https://www.kuaishou.com/short-video/${dataId}`,
+ 'User-Agent':
+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36',
+ },
+ });
+
+ console.log('---- douyin commentAdd ----', res);
+
+ return res;
+ }
+
+
+
+
+
+
+
+
+
}
export const kwaiPub = new KwaiPub();
diff --git a/src/icp/replyother.ts b/src/icp/replyother.ts
index ed2045c1..38161003 100644
--- a/src/icp/replyother.ts
+++ b/src/icp/replyother.ts
@@ -42,11 +42,12 @@ export enum PageType {
/**
* 点赞作品
*/
-export async function icpDianzanDyOther(accountId: number, dataId: string) {
+export async function icpDianzanDyOther(accountId: number, dataId: string, option?: any) {
const res: any = await window.ipcRenderer.invoke(
'ICP_DIANZAN_DY_OTHER',
accountId,
dataId,
+ option,
);
return res;
}
diff --git a/src/views/replyother/index.tsx b/src/views/replyother/index.tsx
index a56547f3..48d15232 100644
--- a/src/views/replyother/index.tsx
+++ b/src/views/replyother/index.tsx
@@ -1,10 +1,4 @@
-/*
- * @Author: nevin
- * @Date: 2025-02-10 22:20:15
- * @LastEditTime: 2025-03-20 21:28:52
- * @LastEditors: nevin
- * @Description: 评论页面 reply
- */
+
import {
icpCreatorList,
icpGetCommentListByOther,
@@ -268,33 +262,6 @@ export default function Page() {
}
}
- async function getFwqCreatorList() {
- setWordList([]);
- const res = await commentApi.runCommentSearchNotesTask(
- 'xhs_comments',
- '美妆',
- );
- console.log('------ getFwqCreatorList', res);
-
- const list = await commentApi.getCommentSearchNotes(
- 'xhs_comments',
- '414381229d04c46cb39f97a5a0b7f9eb',
- );
- console.log('------ getCommentSearchNotes', list);
- const newlist = list.slice(0, 20);
-
- newlist[0].dataId = '67de8bc2000000001c00fdce';
- newlist[0].xsec_token = 'AB-q1Xl6YS66mGgN8y_DMoskX40j7FsSv2DoSQTYE6DYU=';
-
- newlist[1].dataId = '678ce103000000001803c791';
- newlist[1].xsec_token = 'AB-ktiN49qUSB2KL_4EN5bIQSRgCJR_AB1qIv8wAQvj94=';
-
- newlist[2].dataId = '67e3f5bb000000001c003a1c';
- newlist[2].xsec_token = 'CBbspa7hsvsencXRmokLj0bOnzo_IHlX0-qWD3Y3GPpcM=';
-
- setPostList(newlist || []);
- }
-
/**
* 获取二级评论列表
*/
@@ -443,8 +410,9 @@ export default function Page() {
return;
}
- const res = await icpDianzanDyOther(activeAccountId, post.dataId);
- if (res.status_code == 0 || res.data?.code == 0) {
+ const res = await icpDianzanDyOther(activeAccountId, post.dataId, {authid: 1});
+ console.log('------ likePost', res);
+ if (res.status_code == 0 || res.data?.code == 0 || res.data?.visionVideoLike.result == 1) {
message.success('点赞成功');
// 更新点赞状态
setLikedPosts((prev) => ({