Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat: 小红书评论调整
牛文政e4f029a05e5f
diff --git a/electron/main/plat/platforms/douyin/index.ts b/electron/main/plat/platforms/douyin/index.tsindex a67ab749..77340dba 100644--- a/electron/main/plat/platforms/douyin/index.ts+++ b/electron/main/plat/platforms/douyin/index.ts@@ -233,7 +233,7 @@ export class Douyin extends PlatformBase {const cookie: CookiesType = JSON.parse(account.loginCookie);const res = await douyinService.creatorCommentReply(cookie, {comment_Id: commentId,- item_id: option.data.dataId,+ item_id: option.dataId!,text: content,});diff --git a/electron/main/plat/platforms/xhs/index.ts b/electron/main/plat/platforms/xhs/index.tsindex 8173e289..a175ef20 100644--- a/electron/main/plat/platforms/xhs/index.ts+++ b/electron/main/plat/platforms/xhs/index.ts@@ -17,6 +17,7 @@ import {IGetUsersParams,IVideoPublishParams,VideoCallbackType,+ WorkData,} from '../../plat.type';import { PublishVideoResult } from '../../module';import { xiaohongshuService } from '../../../../plat/xiaohongshu';@@ -135,13 +136,23 @@ export class Xhs extends PlatformBase {*/async getWorkList(account: AccountModel,- pageInfo: { pageNo: number; pageSize: number },+ pageInfo: { pageNo: number; pageSize: number; pcursor?: string },) {const cookie: CookiesType = JSON.parse(account.loginCookie);- const ret = await xiaohongshuService.getWorks(cookie);+ const res = await xiaohongshuService.getWorks(cookie);++ const list: WorkData[] = res.data.data.notes.map((v) => ({+ dataId: v.id,+ readCount: v.view_count,+ likeCount: v.likes,+ collectCount: v.collected_count,+ commentCount: v.comments_count,+ title: v.display_title,+ coverUrl: v.images_list[0]?.url || '',+ }));return {- list: [],+ list,count: 0,};}diff --git a/electron/plat/xiaohongshu/index.ts b/electron/plat/xiaohongshu/index.tsindex 7b57eae0..fafa34a9 100644--- a/electron/plat/xiaohongshu/index.ts+++ b/electron/plat/xiaohongshu/index.ts@@ -1364,14 +1364,15 @@ export class XiaohongshuService {}// 获取作品列表- async getWorks(cookie: Electron.Cookie[]) {+ async getWorks(cookie: Electron.Cookie[], page: number = 0) {+ const url = `/web_api/sns/v5/creator/note/user/posted?tab=0&page=${page}`;const reverseRes: any = await this.getReverseResult({- url: '/web_api/sns/v5/creator/note/user/posted?tab=0&page=0',+ url,a1: CookieToString(cookie),});return await requestNet<IXHSGetWorksResponse>({- url: `https://edith.xiaohongshu.com/web_api/sns/v5/creator/note/user/posted?tab=0&page=0`,+ url: `https://edith.xiaohongshu.com${url}`,headers: {cookie: CookieToString(cookie),Referer: this.loginUrl,@@ -1412,14 +1413,14 @@ export class XiaohongshuService {noteId: string,cursor?: number,) {- const url = `https://edith.xiaohongshu.com/api/sns/web/v2/comment/page?note_id=${noteId}&cursor=${cursor || ''}&top_comment_id=&image_formats=jpg,webp,avif&xsec_token=AB9FJ4Lt0GzHqwzKCWh2glQpU_HdfsMIJ5MuRM8aB9Xvo%3D`;+ const url = `/api/sns/web/v2/comment/page?note_id=${noteId}&cursor=${cursor || ''}&top_comment_id=&image_formats=jpg,webp,avif&xsec_token=AB9FJ4Lt0GzHqwzKCWh2glQpU_HdfsMIJ5MuRM8aB9Xvo%3D`;const reverseRes: any = await this.getReverseResult({url,a1: CookieToString(cookie),});return await requestNet<XhsCommentListResponse>({- url,+ url: `https://edith.xiaohongshu.com${url}`,headers: {cookie: CookieToString(cookie),Referer: this.loginUrl,@@ -1446,14 +1447,14 @@ export class XiaohongshuService {content: string,targetCommentId?: string, // "67d4145300000000190210ba") {- const url = `https://edith.xiaohongshu.com/api/sns/web/v1/comment/post`;+ const url = `/api/sns/web/v1/comment/post`;const reverseRes: any = await this.getReverseResult({url,a1: CookieToString(cookie),});return await requestNet<XhsCommentPostResponse>({- url,+ url: `https://edith.xiaohongshu.com${url}`,headers: {cookie: CookieToString(cookie),Referer: this.loginUrl,diff --git a/src/views/reply/index.tsx b/src/views/reply/index.tsxindex 71490086..a060dab4 100644--- a/src/views/reply/index.tsx+++ b/src/views/reply/index.tsx@@ -23,10 +23,18 @@ export default function Page() {const [activeAccountId, setActiveAccountId] = useState<number>(-1);async function getCreatorList() {- const res = await icpCreatorList(4, {+ console.log('------ activeAccountId', activeAccountId);+ if (activeAccountId === -1) {+ return;+ }+ setWordList([]);++ const res = await icpCreatorList(activeAccountId, {pageNo: 1,pageSize: 10,});+ console.log('------ res', res);+setWordList(res.list);}@@ -68,15 +76,19 @@ export default function Page() {return (<div className={styles.reply}>+ <p>评论</p><div><AccountSidebaractiveAccountId={activeAccountId}- onAccountChange={useCallback((info) => {- console.log('----- info', info);+ onAccountChange={useCallback(+ (info) => {+ console.log('----- info', info);- setActiveAccountId(info.id);- getCreatorList();- }, [])}+ setActiveAccountId(info.id);+ getCreatorList();+ },+ [getCreatorList],+ )}/></div><div>