Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat: 抖音评论接口
牛文政97218832992c
diff --git a/electron/plat/Kwai/index.ts b/electron/plat/Kwai/index.tsindex ce2f4b60..29aea4aa 100644--- a/electron/plat/Kwai/index.ts+++ b/electron/plat/Kwai/index.ts@@ -1,5 +1,9 @@import requestNet from '../requestNet';import {+ CommentAddResponse,+ GetCommentListResponse,+ GetPhotoListResponse,+ GetSubCommentListResponse,IGetHomeInfoResponse,IGetHomeOverview,IKwaiGetLocationsResponse,@@ -323,93 +327,92 @@ class KwaiPub {});}- // 获取评论列表- async getCommentList(+ /**+ * 获取作品列表+ * @param cookies+ * @param pcursor+ * @returns+ */+ async getPhotoList(cookies: Electron.Cookie[],- body: {- photoId: '3xsq95w5uxvjx7q';- sortType: '';- selectedComment: false;- 'kuaishou.web.cp.api_ph': '69799694cfd7e689847219cf678dec275266';- },+ pcursor?: number, // 下一页页码) {- return await requestNet<{- result: 1;- currentTime: 1741705055540;- 'host-name': 'public-bjxy-amd-kcs-node26.idcyz.hb1.kwaidc.com';- data: {- photoList: [- {- photoId: '3xsq95w5uxvjx7q';- title: '';- cover: 'https://p2.a.yximgs.com/upic/2025/02/24/21/BMjAyNTAyMjQyMTQ4NDFfNzk4MzE5MzUxXzE1Nzc4MzY4MTM2MV8wXzM=_B05f8067d6793fd47dcbb196af577f7ae.jpg?tag=1-1741705055-nil-0-dcmp1mb85g-21787ddd08616c9d&clientCacheKey=3xsq95w5uxvjx7q.jpg&di=b7c6874b&bp=10000';- playCount: 6;- likeCount: 0;- commentCount: 2;- uploadTime: 1740404944454;- duration: 13300;- isVideo: true;- isSettingSelectedComment: false;- photoSelectedTips: null;- },- {- photoId: '3xezykcnif5a6x9';- title: '第一个';- cover: 'https://p2.a.yximgs.com/upic/2018/01/06/23/BMjAxODAxMDYyMzUxMThfNzk4MzE5MzUxXzQ1MTkzNDUxMDRfMl8z_Ac616ac2c4d4040f79b74ba7a85862176.jpg?tag=1-1741705055-nil-0-o0w3ceakdu-72258dc0921fa396&clientCacheKey=3xezykcnif5a6x9.jpg&di=b7c6874b&bp=10000';- playCount: 4;- likeCount: 0;- commentCount: 0;- uploadTime: 1515253882684;- duration: 11650;- isVideo: true;- isSettingSelectedComment: false;- photoSelectedTips: null;- },- ];- pcursor: 1515253882683;- totalCount: 2;- };- message: '成功';- }>({+ return await requestNet<GetPhotoListResponse>({+ url: `https://cp.kuaishou.com/rest/cp/creator/comment/photoList?__NS_sig3=79692e1e5040f94d562427268d0d3694fc18b05c38383a3a3534372d`,+ method: 'POST',+ headers: {+ cookie: CookieToString(cookies),+ },+ body: {+ 'kuaishou.web.cp.api_ph': '69799694cfd7e689847219cf678dec275266',+ pcursor,+ },+ });+ }++ // 获取评论列表+ async getCommentList(cookies: Electron.Cookie[], photoId: string) {+ return await requestNet<GetCommentListResponse>({url: `https://cp.kuaishou.com/rest/cp/creator/comment/commentList?__NS_sig3=a7b7f0c019bb25938afaf9f86e97581522c66e82e6e6e4e4ebeae9f3`,method: 'POST',headers: {cookie: CookieToString(cookies),},- body,+ body: {+ photoId,+ sortType: '',+ selectedComment: false,+ 'kuaishou.web.cp.api_ph': '69799694cfd7e689847219cf678dec275266',+ },+ });+ }++ // 获取评论的回复列表+ async getSubCommentList(+ cookies: Electron.Cookie[],+ photoId: string,+ commentId: number,+ ) {+ return await requestNet<GetSubCommentListResponse>({+ url: `https://cp.kuaishou.com/rest/cp/creator/comment/subCommentList?__NS_sig3=09195e6e1b33893d26545756e88395048c68c02c48484a4a4544475d`,+ method: 'POST',+ headers: {+ cookie: CookieToString(cookies),+ },+ body: {+ commentId, // 969549966791,+ photoId, //'3xsq95w5uxvjx7q',+ 'kuaishou.web.cp.api_ph': '69799694cfd7e689847219cf678dec275266',+ },});}/**- * 添加评论+ * 添加评论和回复评论* @param cookie* @returns*/- async creatorCommentAdd(+ async commentAdd(cookie: Electron.Cookie[],- body: {- content: '666';- photoId: '3xsq95w5uxvjx7q';- replyToCommentId?: 969549966791;- replyTo?: 798319351;- 'kuaishou.web.cp.api_ph': '69799694cfd7e689847219cf678dec275266';+ photoId: string,+ content: string,+ reply: {+ replyToCommentId?: number; // 969549966791;+ replyTo?: number; // 798319351;},) {- return await requestNet<{- result: 1;- currentTime: 1741704937529;- 'host-name': 'public-bjx-c26-kce-node717.idchb1az1.hb1.kwaidc.com';- data: {- commentId: 969618657810;- };- message: '成功';- }>({+ return await requestNet<CommentAddResponse>({url: 'https://cp.kuaishou.com/rest/cp/creator/comment/add?__NS_sig3=a9b9fecedad12b9d75f4f7f64ed9b1c62cc8608ce8e8eaeae5e4e7fd',method: 'POST',headers: {cookie: CookieToString(cookie),},- body,+ body: {+ content,+ photoId,+ ...reply,+ 'kuaishou.web.cp.api_ph': '69799694cfd7e689847219cf678dec275266',+ },});}}diff --git a/electron/plat/Kwai/kwai.type.ts b/electron/plat/Kwai/kwai.type.tsindex f40c2dc8..9f77aaad 100644--- a/electron/plat/Kwai/kwai.type.ts+++ b/electron/plat/Kwai/kwai.type.ts@@ -140,3 +140,105 @@ export interface ILoginResponse {cookies: Electron.Cookie[];userInfo: IRequestNetResult<IKwaiUserInfoResponse>;}++// 获取作品列表+export interface GetPhotoListResponse {+ result: number; // 1;+ currentTime: number; // 1741842574582;+ 'host-name': string; // 'public-bjxy-rs9-kce-node961.idcyz.hb1.kwaidc.com';+ data: {+ photoList: {+ photoId: string; // '3xsq95w5uxvjx7q';+ title: string; // '';+ cover: string; // 'https://p2.a.yximgs.com/upic/2025/02/24/21/BMjAyNTAyMjQyMTQ4NDFfNzk4MzE5MzUxXzE1Nzc4MzY4MTM2MV8wXzM=_B05f8067d6793fd47dcbb196af577f7ae.jpg?tag=1-1741842574-nil-0-uacnaa9n5n-f19cc27a1c6378c5&clientCacheKey=3xsq95w5uxvjx7q.jpg&di=b7c6874b&bp=10000';+ playCount: number; // 6;+ likeCount: number; // 0;+ commentCount: number; // 2;+ uploadTime: number; // 1740404944454;+ duration: number; // 13300;+ isVideo: true;+ isSettingSelectedComment: boolean; // false;+ photoSelectedTips: any; // null;+ }[];+ pcursor: number; // 1515253882683; // 下一页页码+ totalCount: number; // 2;+ };+ message: string; // '成功';+}++// 获取评论列表+export interface GetCommentListResponse {+ result: number; // 1;+ currentTime: number; // 1741843263417;+ 'host-name': string; // 'public-bjxy-rs9-kce-node961.idcyz.hb1.kwaidc.com';+ data: {+ list: [+ {+ photoId: number; // 157783681361;+ authorId: number; // 798319351;+ headurl: string; // 'https://p66-pro.a.yximgs.com/uhead/AB/2018/01/06/23/BMjAxODAxMDYyMzQ4MjRfNzk4MzE5MzUxXzJfaGQ4OTBfMTcz_s.jpg';+ authorName: string; // '墨2668';+ commentId: number; // 969549966791;+ content: string; // '哈哈哈';+ replyTo: number; // 0;+ replyToUserName: any; // null;+ replyToCommentId: number; // 0;+ timestamp: number; // 1741695330721;+ likedCount: number; // 0;+ liked: boolean; // false;+ subCommentCount: number; // 1;+ emotionId: any; // null;+ emotion: any; // null;+ ip: number; // 0;+ referer: any; // null;+ toped: boolean; // false;+ settingSelectedComment: boolean; // false;+ isSettingSelectedComment: boolean; // false;+ },+ ];+ };+ message: string; // '成功';+}++// 回复评论返回+export interface GetSubCommentListResponse {+ result: number; // 1;+ currentTime: number; // 1741843273188;+ 'host-name': string; // 'public-bjx-c26-kce-node710.idchb1az1.hb1.kwaidc.com';+ data: {+ list: {+ photoId: number; // 157783681361;+ authorId: number; // 798319351;+ headurl: string; // 'https://p66-pro.a.yximgs.com/uhead/AB/2018/01/06/23/BMjAxODAxMDYyMzQ4MjRfNzk4MzE5MzUxXzJfaGQ4OTBfMTcz_s.jpg';+ authorName: string; // '墨2668';+ commentId: number; // 969618657810;+ content: string; // '666';+ replyTo: number; // 798319351;+ replyToUserName: string; // '墨2668';+ replyToCommentId: number; // 0;+ timestamp: number; // 1741704937506;+ likedCount: number; // 0;+ liked: boolean; // false;+ subCommentCount: number; // 0;+ emotionId: any; // null;+ emotion: any; // null;+ ip: number; // 0;+ referer: any; // null;+ toped: boolean; // false;+ settingSelectedComment: boolean; // false;+ isSettingSelectedComment: boolean; // false;+ }[];+ };+ message: string; // '成功';+}++// 创建评论返回参数+export interface CommentAddResponse {+ result: number; // 1;+ currentTime: number; // 1741704937529;+ 'host-name': string; // 'public-bjx-c26-kce-node717.idchb1az1.hb1.kwaidc.com';+ data: {+ commentId: number; // 969618657810;+ };+ message: string; // '成功';+}