Skip to content

Let's use AI to Earn!

feat: 评论ICP接口

牛文政f72cbda9ceb5
diff --git a/electron/main/plat/PlatformBase.ts b/electron/main/plat/PlatformBase.ts
index 34caebb4..50ba3ea5 100644
--- a/electron/main/plat/PlatformBase.ts
+++ b/electron/main/plat/PlatformBase.ts
@@ -92,7 +92,14 @@ export abstract class PlatformBase {
*/
abstract getWorkData(dataId: string): Promise<WorkData>;
- // 在该平台发布视频
+ /**
+ * 获取评论列表
+ */
+ abstract getCommentList(account: AccountModel, dataId: string): Promise<any>;
+
+ /**
+ * 在该平台发布视频
+ */
abstract videoPublish(
params: IVideoPublishParams,
// 获取发布进度的回调函数
diff --git a/electron/main/plat/platforms/Kwai/index.ts b/electron/main/plat/platforms/Kwai/index.ts
index 74b95df4..a92e7788 100644
--- a/electron/main/plat/platforms/Kwai/index.ts
+++ b/electron/main/plat/platforms/Kwai/index.ts
@@ -8,6 +8,7 @@
import { PlatformBase } from '../../PlatformBase';
import {
AccountInfoTypeRV,
+ CookiesType,
DashboardData,
IAccountInfoParams,
IGetLocationDataParams,
@@ -168,6 +169,11 @@ export class Kwai extends PlatformBase {
};
}
+ async getCommentList(account: AccountModel, dataId: string) {
+ const cookie: CookiesType = JSON.parse(account.loginCookie);
+ return [];
+ }
+
async loginCheck(account: AccountModel): Promise<boolean> {
const res = await kwaiPub.getAccountInfo(JSON.parse(account.loginCookie));
return !(res.status !== 200 || !res.data.data.userName);
diff --git a/electron/main/plat/platforms/douyin/index.ts b/electron/main/plat/platforms/douyin/index.ts
index a8be6b61..e8d648c5 100644
--- a/electron/main/plat/platforms/douyin/index.ts
+++ b/electron/main/plat/platforms/douyin/index.ts
@@ -152,6 +152,11 @@ export class Douyin extends PlatformBase {
};
}
+ async getCommentList(account: AccountModel, dataId: string) {
+ const cookie: CookiesType = JSON.parse(account.loginCookie);
+ return [];
+ }
+
async videoPublish(
params: IVideoPublishParams,
callback: VideoCallbackType,
diff --git a/electron/main/plat/platforms/wxSph/index.ts b/electron/main/plat/platforms/wxSph/index.ts
index 8c6e16eb..c948ee0e 100644
--- a/electron/main/plat/platforms/wxSph/index.ts
+++ b/electron/main/plat/platforms/wxSph/index.ts
@@ -128,16 +128,13 @@ export class WxSph extends PlatformBase {
pageInfo: { pageNo: number; pageSize: number },
) {
const cookie: CookiesType = JSON.parse(account.loginCookie);
- const res = await shipinhaoService.getPostList(cookie, {
- pageNo: 1,
- pageSize: 10,
- });
+ const res = await shipinhaoService.getPostList(cookie, pageInfo);
const listData: WorkData[] = res.list.map((item) => {
return {
dataId: item.objectId,
commentCount: item.commentCount,
- title: item.desc.shortTitle[0] || '',
+ title: item.desc.shortTitle[0]?.shortTitle || '',
desc: item.desc.description,
coverUrl: item.desc.media[0]?.coverUrl || '',
videoUrl: item.desc.media[0]?.url || '',
@@ -161,6 +158,14 @@ export class WxSph extends PlatformBase {
};
}
+ async getCommentList(account: AccountModel, dataId: string) {
+ const cookie: CookiesType = JSON.parse(account.loginCookie);
+ const res = await shipinhaoService.getCommentList(cookie, dataId);
+ console.log('------ res', res);
+
+ return res;
+ }
+
async getUsers(params: IGetUsersParams) {
const usersRes = await shipinhaoService.getUsers(
JSON.parse(params.account.loginCookie),
diff --git a/electron/main/plat/platforms/xhs/index.ts b/electron/main/plat/platforms/xhs/index.ts
index 54f98945..d67f9bcd 100644
--- a/electron/main/plat/platforms/xhs/index.ts
+++ b/electron/main/plat/platforms/xhs/index.ts
@@ -152,6 +152,11 @@ export class Xhs extends PlatformBase {
dataId: '',
};
}
+
+ async getCommentList(account: AccountModel, dataId: string) {
+ const cookie: CookiesType = JSON.parse(account.loginCookie);
+ return [];
+ }
/**
* @param params
* @param callback
diff --git a/electron/main/reply/controller.ts b/electron/main/reply/controller.ts
index f83d1592..73acfc95 100644
--- a/electron/main/reply/controller.ts
+++ b/electron/main/reply/controller.ts
@@ -8,6 +8,7 @@
import { AccountType } from '../../../commont/AccountEnum';
import { AccountService } from '../account/service';
import { Controller, Icp, Inject } from '../core/decorators';
+import platController from '../plat';
import { ReplyService } from './service';
@Controller()
@@ -25,18 +26,15 @@ export class ReplyController {
async getCreatorList(
event: Electron.IpcMainInvokeEvent,
accountId: number,
+ pageInfo: {
+ pageNo: number;
+ pageSize: number;
+ },
): Promise<any> {
const account = await this.accountService.getAccountById(accountId);
if (!account) return null;
- if (account.type === AccountType.Douyin) {
- const res = await this.replyService.testGetDouyinList(account);
- return res;
- }
-
- if (account.type === AccountType.WxSph) {
- const res = await this.replyService.testGetSphCreatorList(account);
- return res;
- }
+ const res = await platController.getWorkList(account, pageInfo);
+ return res;
}
}
diff --git a/electron/main/reply/service.ts b/electron/main/reply/service.ts
index 8e4ab2c3..3b4b8f48 100644
--- a/electron/main/reply/service.ts
+++ b/electron/main/reply/service.ts
@@ -5,44 +5,6 @@
* @Description: Reply reply
*/
import { Injectable } from '../core/decorators';
-import { douyinService } from '../../plat/douyin/index';
-import { AccountModel } from '../../db/models/account';
-import { shipinhaoService } from '../../plat/shipinhao';
@Injectable()
-export class ReplyService {
- // 测试获取抖音作品列表
- async testGetDouyinList(account: AccountModel) {
- const cookie: Electron.Cookie[] = JSON.parse(account.loginCookie);
-
- let msToken = '';
- for (let i = 0; i < cookie.length; i++) {
- if (cookie[i].name === 'msToken') {
- msToken = cookie[i].value;
- break;
- }
- }
- console.log('------ msToken ----', msToken);
-
- // 秒级时间戳
- const timestamp = Date.now();
- console.log('------ timestamp ----', timestamp);
-
- const res = await douyinService.getCreatorItems(cookie, timestamp + '', '');
-
- console.log('------ res ----', res);
-
- return 1;
- }
-
- async testGetSphCreatorList(account: AccountModel) {
- const cookie: Electron.Cookie[] = JSON.parse(account.loginCookie);
-
- const res = await shipinhaoService.getPostList(cookie, {
- pageNo: 1,
- pageSize: 10,
- });
-
- console.log('------ res ----', res);
- }
-}
+export class ReplyService {}
diff --git a/electron/plat/shipinhao/index.ts b/electron/plat/shipinhao/index.ts
index fccb627b..38c54622 100644
--- a/electron/plat/shipinhao/index.ts
+++ b/electron/plat/shipinhao/index.ts
@@ -1362,33 +1362,30 @@ export class ShipinhaoService {
/**
* 获取评论列表
* @param cookie
- * @param keyword
- * @param page
+ * @param exportId
* @returns
*/
- async getCommentList(
- cookie: Electron.Cookie[],
- body: {
- commentSelection: false;
- exportId: 'export/UzFfAgtgekIEAQAAAAAAOhIpzVxlAQAAAAstQy6ubaLX4KHWvLEZgBPExKFQKCowfoSJzNPgMJrD53jJrD_NBzgU3Ncr3usg';
- forMcn: false;
- lastBuff: '';
- pluginSessionId: null;
- rawKeyBuff: null;
- reqScene: 7;
- scene: 7;
- timestamp: '1741697703260';
- _log_finder_id: 'v2_060000231003b20faec8c5e38b10cbd6cb06ef3cb077ad5b14a8587570bc414e95c4b7e034ea@finder';
- _log_finder_uin: '';
- },
- ) {
+ async getCommentList(cookie: Electron.Cookie[], exportId: string) {
return await requestNet<WeChatVideoUserData>({
url: `https://channels.weixin.qq.com/micro/interaction/cgi-bin/mmfinderassistant-bin/comment/comment_list?_rid=67d032a7-6c8f7126`,
headers: {
cookie: CookieToString(cookie),
},
method: 'POST',
- body,
+ body: {
+ commentSelection: false,
+ exportId,
+ forMcn: false,
+ lastBuff: '',
+ pluginSessionId: null,
+ rawKeyBuff: null,
+ reqScene: 7,
+ scene: 7,
+ timestamp: Date.now() + '',
+ _log_finder_id:
+ 'v2_060000231003b20faec8c5e38b10cbd6cb06ef3cb077ad5b14a8587570bc414e95c4b7e034ea@finder',
+ _log_finder_uin: '',
+ },
});
}
diff --git a/electron/plat/shipinhao/wxShp.type.ts b/electron/plat/shipinhao/wxShp.type.ts
index c94ab9cb..fed3116d 100644
--- a/electron/plat/shipinhao/wxShp.type.ts
+++ b/electron/plat/shipinhao/wxShp.type.ts
@@ -110,7 +110,9 @@ export interface SphGetPostListResponse {
cardShowStyle: number; // 0;
}[];
mentionedMusics: any[];
- shortTitle: any[];
+ shortTitle: {
+ shortTitle: string; // '我家的干饭宝宝';
+ }[];
description: string; // '#干饭宝宝';
mediaType: number; // 4;
location: {