Skip to content

Let's use AI to Earn!

小红书

DESKTOP-ZTS2NQJNAb58256234168
diff --git a/electron/main/plat/PlatformBase.ts b/electron/main/plat/PlatformBase.ts
index 6317741d..452cc97b 100644
--- a/electron/main/plat/PlatformBase.ts
+++ b/electron/main/plat/PlatformBase.ts
@@ -78,7 +78,7 @@ export abstract class PlatformBase {
/**
- * 获取作品列表
+ * 点赞
* @param account 账户
* @param pcursor 分页游标
*/
@@ -89,7 +89,7 @@ export abstract class PlatformBase {
/**
- * 获取作品列表
+ * 收藏
* @param account 账户
* @param pcursor 分页游标
*/
diff --git a/electron/main/plat/platforms/xhs/index.ts b/electron/main/plat/platforms/xhs/index.ts
index 207782ec..68ec253c 100644
--- a/electron/main/plat/platforms/xhs/index.ts
+++ b/electron/main/plat/platforms/xhs/index.ts
@@ -158,7 +158,8 @@ export class Xhs extends PlatformBase {
coverUrl: v.images_list[0]?.url || '',
}));
- const count = res.data.data.tags[0].notes_count;
+ console.log('------ getWorkList xhs ---', res.data);
+ const count = res.data.data?.tags[0]?.notes_count || 0;
const hasMore = count > pageSize * (pageNo + 1);
return {
list,
@@ -237,24 +238,95 @@ export class Xhs extends PlatformBase {
dataId: string,
pcursor?: string,
) {
+ const cookie: CookiesType = JSON.parse(account.loginCookie);
+ console.log('------ getCreatorCommentListByOther xhs dataId---', dataId);
+ const res = await xiaohongshuService.getCommentList(cookie, dataId);
+
+ const list: CommentData[] = [];
+
+ for (const v of res.data.data.comments) {
+ const subList: CommentData[] = [];
+
+ for (const sub of v.sub_comments) {
+ subList.push({
+ userId: sub.user_info.user_id,
+ dataId: v.note_id,
+ commentId: sub.id,
+ parentCommentId: v.id,
+ content: sub.content,
+ likeCount: Number.parseInt(sub.like_count),
+ nikeName: sub.user_info.nickname,
+ headUrl: sub.user_info.image,
+ subCommentList: [],
+ });
+ }
+
+ list.push({
+ userId: v.user_info.user_id,
+ dataId: v.note_id,
+ commentId: v.id,
+ parentCommentId: undefined,
+ content: v.content,
+ likeCount: Number.parseInt(v.like_count),
+ nikeName: v.user_info.nickname,
+ headUrl: v.user_info.image,
+ data: v,
+ subCommentList: subList,
+ });
+ }
+
return {
- list: [],
+ list: list,
pageInfo: {
- count: 0,
- pcursor: '',
- hasMore: false,
+ hasMore: res.data.data.has_more,
+ pcursor: res.data.data.cursor,
},
};
}
+
+
async createCommentByOther(
account: AccountModel,
dataId: string, // 作品ID
content: string,
) {
- return null;
+ const cookie: CookiesType = JSON.parse(account.loginCookie);
+ const ret = await xiaohongshuService.commentPost(cookie, dataId, content);
+ console.log('------ createCommentByOther xhs ---', ret);
+ return ret;
+ }
+
+
+
+ async dianzanDyOther(
+ account: AccountModel,
+ dataId: string, // 作品ID
+ ) {
+ console.log('------ dianzanDyOther3333', dataId);
+ const cookie: CookiesType = JSON.parse(account.loginCookie);
+ const res = await xiaohongshuService.likeNote(cookie, dataId);
+
+ console.log('------ res', res);
+
+ return res;
}
+ async shoucangDyOther(
+ account: AccountModel,
+ dataId: string, // 作品ID
+ ) {
+ console.log('------ dianzanDyOther5555', dataId);
+ const cookie: CookiesType = JSON.parse(account.loginCookie);
+ const res = await xiaohongshuService.shoucangNote(cookie, dataId);
+
+ console.log('------ res', res);
+
+ return res;
+ }
+
+
+
async replyCommentByOther(
account: AccountModel,
commentId: string,
@@ -264,7 +336,15 @@ export class Xhs extends PlatformBase {
comment: any; // 辅助数据,原数据
},
) {
- return null;
+ const cookie: CookiesType = JSON.parse(account.loginCookie);
+ const ret = await xiaohongshuService.commentPost(
+ cookie,
+ option.dataId!,
+ content,
+ commentId,
+ );
+
+ return ret;
}
async createComment(
diff --git a/electron/plat/xiaohongshu/index.ts b/electron/plat/xiaohongshu/index.ts
index 0c2cdb47..8874c56b 100644
--- a/electron/plat/xiaohongshu/index.ts
+++ b/electron/plat/xiaohongshu/index.ts
@@ -1416,7 +1416,7 @@ export class XiaohongshuService {
noteId: string,
cursor?: number,
) {
- 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 url = `/api/sns/web/v2/comment/page?note_id=${noteId}&cursor=${cursor || ''}&top_comment_id=&image_formats=jpg,webp,avif&xsec_token=AB_MsaT7Zyowo9N1n4eq0PL4xN9QLxe6JstFjA_Isc9x8%3D`;
const reverseRes: any = await this.getReverseResult({
url,
a1: CookieToString(cookie),
@@ -1441,6 +1441,92 @@ export class XiaohongshuService {
return res;
}
+
+ /**
+ * 点赞作品
+ * @param cookie
+ * @param noteId
+ * @param content
+ * @param targetCommentId // 回复的评论ID
+ * @returns
+ */
+ async likeNote(
+ cookie: Electron.Cookie[],
+ noteId: string,
+ ) {
+ const url = `/api/sns/web/v1/note/like`;
+ const body = {
+ note_oid: noteId,
+ };
+ const reverseRes: any = await this.getReverseResult({
+ url,
+ a1: CookieToString(cookie),
+ data: body,
+ });
+
+ const res = await requestNet<XhsCommentPostResponse>({
+ url: `https://edith.xiaohongshu.com${url}`,
+ headers: {
+ cookie: CookieToString(cookie),
+ Referer: 'https://www.xiaohongshu.com/',
+ Origin: 'https://www.xiaohongshu.com',
+ 'X-S': reverseRes['X-s'],
+ 'X-T': reverseRes['X-t'],
+ userAgent:
+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36 Edg/100.0.1185.36',
+ },
+ method: 'POST',
+ body,
+ });
+
+ console.log('--- xhs likeNote --- res', res);
+
+ return res;
+ }
+
+
+ /**
+ * 点赞作品
+ * @param cookie
+ * @param noteId
+ * @param content
+ * @param targetCommentId // 回复的评论ID
+ * @returns
+ */
+ async shoucangNote(
+ cookie: Electron.Cookie[],
+ noteId: string,
+ ) {
+ const url = `/api/sns/web/v1/note/collect`;
+ const body = {
+ note_id: noteId,
+ };
+ const reverseRes: any = await this.getReverseResult({
+ url,
+ a1: CookieToString(cookie),
+ data: body,
+ });
+
+ const res = await requestNet<XhsCommentPostResponse>({
+ url: `https://edith.xiaohongshu.com${url}`,
+ headers: {
+ cookie: CookieToString(cookie),
+ Referer: 'https://www.xiaohongshu.com/',
+ Origin: 'https://www.xiaohongshu.com',
+ 'X-S': reverseRes['X-s'],
+ 'X-T': reverseRes['X-t'],
+ userAgent:
+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36 Edg/100.0.1185.36',
+ },
+ method: 'POST',
+ body,
+ });
+
+ console.log('--- xhs shoucangNote --- res', res);
+
+ return res;
+ }
+
/**
* 评论作品
* @param cookie
diff --git a/src/views/replyother/components/replyComment.tsx b/src/views/replyother/components/replyComment.tsx
index 46f8548e..b7ef1df9 100644
--- a/src/views/replyother/components/replyComment.tsx
+++ b/src/views/replyother/components/replyComment.tsx
@@ -43,8 +43,8 @@ const Com = forwardRef<ReplyCommentRef>((props: any, ref) => {
comment: commentData!.data,
},
);
- // console.log('----- res', res.status_code, res.data);
- if (res.status_code == 0) {
+ console.log('----- replyComment res', res);
+ if (res.status_code == 0 || res.data.code == 0) {
message.success('回复成功');
setIsModalOpen(false);
} else {
diff --git a/src/views/replyother/components/replyWorks.tsx b/src/views/replyother/components/replyWorks.tsx
index 1bf498a1..12278dd8 100644
--- a/src/views/replyother/components/replyWorks.tsx
+++ b/src/views/replyother/components/replyWorks.tsx
@@ -19,6 +19,7 @@ const Com = forwardRef<ReplyWorksRef>((props: any, ref) => {
async function init(accountId: number, inWorkData: WorkData) {
setAccountId(accountId);
+ console.log('------ init-inWorkData', inWorkData);
setWorkData(inWorkData);
setIsModalOpen(true);
}
@@ -37,11 +38,12 @@ const Com = forwardRef<ReplyWorksRef>((props: any, ref) => {
async function createComment(content: string) {
const res = await icpCreateComment(
accountId,
- '7484585415068880139',
+ // workData!.dataId,
+ '67d624a2000000001d02c637',
content,
);
console.log('----- res', res);
- if (res.status_code == 0) {
+ if (res.status_code == 0 || res.data.code == 0) {
message.success('评论成功');
setIsModalOpen(false);
} else {
diff --git a/src/views/replyother/index.tsx b/src/views/replyother/index.tsx
index 8e7e126c..2237133c 100644
--- a/src/views/replyother/index.tsx
+++ b/src/views/replyother/index.tsx
@@ -48,7 +48,8 @@ export default function Page() {
// 7483006686274374962 7478960244136086784
const res = await icpGetCommentListByOther(
activeAccountId,
- '7480598266392972596',
+ // '7480598266392972596',
+ '67d624a2000000001d02c637',
);
console.log('------ icpGetCommentList', res);
@@ -92,9 +93,10 @@ export default function Page() {
*/
async function dianzanFunc(data: WorkData) {
console.log('------ dianzanFunc', data);
- const res = await icpDianzanDyOther(activeAccountId, '7485806097282993419');
+ // const res = await icpDianzanDyOther(activeAccountId, '7485806097282993419'); // 抖音
+ const res = await icpDianzanDyOther(activeAccountId, '67e386fc000000001201fa38');
console.log('----- res', res);
- if (res.status_code == 0) {
+ if (res.status_code == 0 || res.data.code == 0) {
message.success('点赞成功');
} else {
message.error('点赞失败');
@@ -106,9 +108,10 @@ export default function Page() {
*/
async function shoucangFunc(data: WorkData) {
console.log('------ shoucangFunc', data);
- const res = await icpShoucangDyOther(activeAccountId, '7485806097282993419');
+ // const res = await icpShoucangDyOther(activeAccountId, '7485806097282993419'); // 抖音
+ const res = await icpShoucangDyOther(activeAccountId, '67e386fc000000001201fa38');
console.log('----- res', res);
- if (res.status_code == 0) {
+ if (res.status_code == 0 || res.data.code == 0) {
message.success('收藏成功');
} else {
message.error('收藏失败');