Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
dy 评论列表
DESKTOP-ZTS2NQJNAce39cc416719
diff --git a/electron/main/plat/PlatformBase.ts b/electron/main/plat/PlatformBase.tsindex 54602d8f..4461f350 100644--- a/electron/main/plat/PlatformBase.ts+++ b/electron/main/plat/PlatformBase.ts@@ -107,6 +107,21 @@ export abstract class PlatformBase {pageInfo: ResponsePageInfo;}>;+ /**+ * 获取评论列表+ * @param account+ * @param dataId+ * @param pcursor+ */+ abstract getCreatorCommentListByOther(+ account: AccountModel,+ dataId: string,+ pcursor?: string,+ ): Promise<{+ list: CommentData[];+ pageInfo: ResponsePageInfo;+ }>;+/*** 创建评论*/diff --git a/electron/main/plat/index.ts b/electron/main/plat/index.tsindex 339dad05..37dd3304 100644--- a/electron/main/plat/index.ts+++ b/electron/main/plat/index.ts@@ -173,6 +173,21 @@ class PlatController {return await platform.getCommentList(account, dataId, pcursor);}+ /**+ * 获取评论列表+ * @param account+ * @param pageInfo+ */+ public async getCreatorCommentListByOther(+ account: AccountModel,+ dataId: string,+ pcursor?: string,+ ) {+ const platform = this.platforms.get(account.type)!;+ return await platform.getCreatorCommentListByOther(account, dataId, pcursor);+ }++/*** 创建评论* @param accountdiff --git a/electron/main/plat/platforms/douyin/index.ts b/electron/main/plat/platforms/douyin/index.tsindex 16b34d86..71b32d5f 100644--- a/electron/main/plat/platforms/douyin/index.ts+++ b/electron/main/plat/platforms/douyin/index.ts@@ -246,6 +246,73 @@ export class Douyin extends PlatformBase {};}++ async getCreatorCommentListByOther(+ account: AccountModel,+ dataId: string,+ pcursor?: string,+ ) {+ const cookie: CookiesType = JSON.parse(account.loginCookie);+ const res = await douyinService.getCreatorCommentListByOther(cookie, dataId, {+ count: pcursor ? 20 : undefined,+ cursor: pcursor || undefined,+ });++ const list: CommentData[] = [];+ console.log('------ douyinService.getCreatorCommentListByOther', res.data.comments);++ // for (const v of res.data.comment_info_list) {+ // const subList: CommentData[] = [];+ // if (v.level === 1 && Number.parseInt(v.reply_count) > 0) {+ // const res2 = await douyinService.getCreatorCommentReplyList(+ // cookie,+ // v.comment_id,+ // {+ // cursor: 0 + '',+ // count: 20,+ // },+ // );++ // if (res2.status === 200 && res2.data.status_code === 0) {+ // for (const element of res2.data.comment_info_list) {+ // subList.push({+ // userId: element.user_info.user_id,+ // dataId: dataId,+ // commentId: element.comment_id,+ // content: element.text,+ // likeCount: Number.parseInt(element.digg_count),+ // nikeName: element.user_info.screen_name,+ // headUrl: element.user_info.avatar_url,+ // data: element,+ // subCommentList: [],+ // });+ // }+ // }+ // }++ // list.push({+ // userId: v.user_info.user_id,+ // dataId: dataId,+ // commentId: v.comment_id,+ // content: v.text,+ // likeCount: Number.parseInt(v.digg_count),+ // nikeName: v.user_info.screen_name,+ // headUrl: v.user_info.avatar_url,+ // data: v,+ // subCommentList: subList,+ // });+ // }++ return {+ list,+ pageInfo: {+ count: res.data.total_count,+ pcursor: res.data.cursor + '',+ hasMore: res.data.has_more,+ },+ };+ }+async createComment(account: AccountModel,dataId: string, // 作品IDdiff --git a/electron/main/reply/controller.ts b/electron/main/reply/controller.tsindex 8ac0d0b5..796430b5 100644--- a/electron/main/reply/controller.ts+++ b/electron/main/reply/controller.ts@@ -57,7 +57,7 @@ export class ReplyController {accountId: number,dataId: string,pcursor?: string,- ): Promise<any> {+ ): Promise<any> {const account = await this.accountService.getAccountById(accountId);if (!account) return null;@@ -65,6 +65,23 @@ export class ReplyController {return res;}+ /**+ * 获取评论列表+ */+ @Icp('ICP_COMMENT_LIST_BY_OTHER')+ async getCommentListByOther(+ event: Electron.IpcMainInvokeEvent,+ accountId: number,+ dataId: string,+ pcursor?: string,+ ): Promise<any> {+ const account = await this.accountService.getAccountById(accountId);+ if (!account) return null;++ const res = await platController.getCreatorCommentListByOther(account, dataId, pcursor);+ return res;+ }+/*** 创建评论*/diff --git a/electron/plat/douyin/index.ts b/electron/plat/douyin/index.tsindex 79d3431f..66176ac5 100644--- a/electron/plat/douyin/index.ts+++ b/electron/plat/douyin/index.ts@@ -2311,6 +2311,73 @@ export class DouyinService {return res;}++ // 查看作品的评论列表+ async getCreatorCommentListByOther(+ cookie: Electron.Cookie[],+ item_id: string, // 作品ID+ pageInfo: {+ cursor?: string;+ count?: number;+ },+ ) {+ const res = await requestNet<DouyinCreatorCommentListResponse>({+ url: CommonUtils.buildUrl(+ `https://www.douyin.com/aweme/v1/web/comment/list/`,+ {+ cursor: pageInfo.cursor,+ count: pageInfo.count,+ aweme_id: item_id,+ // device_platform: 'webapp',+ aid: 6383,+ // channel: 'channel_pc_web',+ // item_type: 0,+ // insert_ids: '',+ // whale_cut_token: '',+ // cut_version: 1,+ // rcFT: '',+ // update_version_code: 170400,+ // pc_client_type: 1,+ // pc_libra_divert: 'Windows',+ // support_h265: 1,+ // support_dash: 1,+ // version_code: 170400,+ // version_name: '17.4.0',+ // cookie_enabled: true,+ // screen_width: 2560,+ // screen_height: 1440,+ // browser_language: 'zh-CN',+ // browser_platform: 'Win32',+ // browser_name: 'Chrome',+ // browser_version: '134.0.0.0',+ // browser_online: true,+ // engine_name: 'Blink',+ // engine_version: '134.0.0.0',+ // os_name: 'Windows',+ // os_version: '10',+ // cpu_core_num: 6,+ // device_memory: 8,+ // platform: 'PC',+ // downlink: 1.45,+ // effective_type: '3g',+ // round_trip_time: 350,+ // webid: '7462760265944598025',+ // uifid: '5a0fbbb49c6c57acd77ca86d66dd2e8e2f1fcf7b3fa6b8a56e480f684bd08589f91733f27477dce40e099eb7d637f09445a7ad8892b1bf8acbb37840aafe36d735e7c5beb76859eb4beca27d1809fa0c5e3a6237a3035941e4f018b7a8d0bb5ae2fdd75341387e35816986e9747d52ef9467c7a82e12a9018904cb5a3f31a1a6e300702b83ee316dcf81a88042fe48160ce0e6c7d6ef3f5bd76799c5b6f98f15',+ // msToken: 'IiU0XpVi5HCA8CoIKsClI4ebuZ3-uzekTlljc8bdH_-mKm5XppBEpMKss_591g-lH9eI-Am1Hzae4NbwkokD0KgQqKBZXqxQKlOPb4n6p6kVe-yyj81KV7uYIc4HT5jZXMS5VKzgiAiYMLHBjHFclkPP2W8cyyOL-hwRKbPD5OzQp_qH07ouFQ==',+ // a_bogus: 'dX0fgqUEY2mfFdKGuOfg743UWS2/Nsuyz-idReZPHOOLT7lGmRPGpPSZbozcYEW5MWB0h937iVllYxdcKsXkZKrpwmhvS/7RsUI998so0qqpT0hDEqfNCwWT9JaT0cwL8CKbJARVUzmc2dA4D1r0UB-JH/Pn4mipQHaWdnUGT9tfgM49PrFxuOtDiXzx5OI41f==',+ // verifyFp: 'verify_m8mhezqw_4VakJnSY_T1HQ_4lSe_8ZFw_iK3fj7GWvctC',+ // fp: 'verify_m8mhezqw_4VakJnSY_T1HQ_4lSe_8ZFw_iK3fj7GWvctC',+ },+ ),+ headers: {+ cookie: CookieToString(cookie),+ },+ method: 'GET',+ });+ console.log('------ getCreatorCommentListByOther', res);+ return res;+ }+// 查看评论的回复列表async getCreatorCommentReplyList(cookie: Electron.Cookie[],diff --git a/src/icp/replyother.ts b/src/icp/replyother.tsindex 285f3513..d2294cb3 100644--- a/src/icp/replyother.ts+++ b/src/icp/replyother.ts@@ -52,10 +52,11 @@ export async function icpCreatorList(accountId: number, pcursor?: string) {return res;}+/*** 获取评论列表*/-export async function icpGetCommentList(+export async function icpGetCommentListByOther(accountId: number,dataId: string,pcursor?: string,@@ -68,7 +69,7 @@ export async function icpGetCommentList(pcursor?: string;};} = await window.ipcRenderer.invoke(- 'ICP_COMMENT_LIST',+ 'ICP_COMMENT_LIST_BY_OTHER',accountId,dataId,pcursor,@@ -76,6 +77,7 @@ export async function icpGetCommentList(return res;}+/*** 创建评论*/diff --git a/src/views/replyother/index.tsx b/src/views/replyother/index.tsxindex 3c8800a2..9d683799 100644--- a/src/views/replyother/index.tsx+++ b/src/views/replyother/index.tsx@@ -7,7 +7,7 @@*/import {icpCreatorList,- icpGetCommentList,+ icpGetCommentListByOther,WorkData,CommentData,icpCreateCommentList,@@ -21,7 +21,7 @@ import ReplyWorks, { ReplyWorksRef } from './components/replyWorks';import ReplyComment, { ReplyCommentRef } from './components/replyComment';import AddAutoRun, { AddAutoRunRef } from './components/addAutoRun';-export default function Page() {+export default function Page() {const [wordList, setWordList] = useState<WorkData[]>([]);const [commentList, setCommentList] = useState<CommentData[]>([]);const [activeAccountId, setActiveAccountId] = useState<number>(-1);@@ -29,14 +29,14 @@ export default function Page() {const Ref_AddAutoRun = useRef<AddAutoRunRef>(null);const Ref_ReplyComment = useRef<ReplyCommentRef>(null);- async function getCreatorList() {+ async function getCreatorList(thisid: any) {+ setWordList([]);if (activeAccountId === -1) {return;}- setWordList([]);-- const res = await icpCreatorList(activeAccountId);-+ let thisida = thisid?thisid:activeAccountId;+ const res = await icpCreatorList(thisida);+ console.log('------ icpCreatorList', res);setWordList(res.list);}@@ -44,8 +44,8 @@ export default function Page() {* 获取评论列表*/async function getCommentList(dataId: string) {- const res = await icpGetCommentList(activeAccountId, dataId);- console.log('------ res', res);+ const res = await icpGetCommentListByOther(activeAccountId, '7478960244136086784');+ console.log('------ icpGetCommentList', res);setCommentList(res.list);}@@ -91,7 +91,7 @@ export default function Page() {onAccountChange={useCallback((info) => {setActiveAccountId(info.id);- getCreatorList();+ getCreatorList(info.id);},[getCreatorList],)}