Skip to content

Let's use AI to Earn!

feat: 获取抖音作品列表

牛文政e6da61ab6060
diff --git a/electron/main/app.ts b/electron/main/app.ts
index 88e4602a..dbd0ec7d 100644
--- a/electron/main/app.ts
+++ b/electron/main/app.ts
@@ -16,6 +16,7 @@ import { TestModule } from './test/module';
import { ToolsModule } from './tools/module';
import { AppController } from './controller';
import { AppService } from './service';
+import { ReplyModule } from './reply/module';
@Module({
imports: [
@@ -26,6 +27,7 @@ import { AppService } from './service';
BackupModule,
DataCenterModule,
TestModule,
+ ReplyModule,
],
controllers: [AppController],
providers: [AppService],
diff --git a/electron/main/reply/comment.ts b/electron/main/reply/comment.ts
new file mode 100644
index 00000000..8500f0bb
--- /dev/null
+++ b/electron/main/reply/comment.ts
@@ -0,0 +1,27 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-01-21 21:12:52
+ * @LastEditTime: 2025-02-21 21:13:19
+ * @LastEditors: nevin
+ * @Description:
+ */
+import { store } from '../../global/store';
+import { IUserStore } from '@/store/user';
+import { IUserInfo } from '@/api/types/user-t';
+import { StoreKey } from '../../../src/utils/StroeEnum';
+
+// 完整的响应数据接口
+interface ResponseData {
+ state: IUserStore;
+ version: number;
+}
+
+export function getUserInfo(): IUserInfo {
+ const res: ResponseData = JSON.parse(store.get(StoreKey.User));
+ return res.state.userInfo!;
+}
+
+export function getUserToken() {
+ const res: ResponseData = JSON.parse(store.get(StoreKey.User));
+ return res.state.token;
+}
diff --git a/electron/main/reply/controller.ts b/electron/main/reply/controller.ts
new file mode 100644
index 00000000..635704f8
--- /dev/null
+++ b/electron/main/reply/controller.ts
@@ -0,0 +1,34 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-01-20 22:02:54
+ * @LastEditTime: 2025-02-06 19:14:12
+ * @LastEditors: nevin
+ * @Description: reply Reply
+ */
+import { AccountService } from '../account/service';
+import { Controller, Icp, Inject } from '../core/decorators';
+import { ReplyService } from './service';
+
+@Controller()
+export class ReplyController {
+ @Inject(ReplyService)
+ private readonly replyService!: ReplyService;
+
+ @Inject(AccountService)
+ private readonly accountService!: AccountService;
+
+ /**
+ * 测试获取抖音作品列表
+ */
+ @Icp('ICP_CREATOR_LIST')
+ async addUser(
+ event: Electron.IpcMainInvokeEvent,
+ accountId: number,
+ ): Promise<any> {
+ const account = await this.accountService.getAccountById(accountId);
+ if (!account) return null;
+
+ const res = await this.replyService.testGetDouyinList(account);
+ return res;
+ }
+}
diff --git a/electron/main/reply/module.ts b/electron/main/reply/module.ts
new file mode 100644
index 00000000..d3498eb8
--- /dev/null
+++ b/electron/main/reply/module.ts
@@ -0,0 +1,18 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-01-24 16:35:59
+ * @LastEditTime: 2025-02-06 19:14:24
+ * @LastEditors: nevin
+ * @Description: reply Reply 评论
+ */
+import { AccountModule } from '../account/module';
+import { Module } from '../core/decorators';
+import { ReplyController } from './controller';
+import { ReplyService } from './service';
+
+@Module({
+ imports: [AccountModule],
+ controllers: [ReplyController],
+ providers: [ReplyService],
+})
+export class ReplyModule {}
diff --git a/electron/main/reply/service.ts b/electron/main/reply/service.ts
new file mode 100644
index 00000000..48fe3b01
--- /dev/null
+++ b/electron/main/reply/service.ts
@@ -0,0 +1,26 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-01-24 17:10:35
+ * @LastEditors: nevin
+ * @Description: Reply reply
+ */
+import { Injectable } from '../core/decorators';
+import { douyinService } from '../../plat/douyin/index';
+import { AccountModel } from '../../db/models/account';
+
+@Injectable()
+export class ReplyService {
+ // 测试获取抖音作品列表
+ async testGetDouyinList(account: AccountModel) {
+ const cookie: any = JSON.parse(account.loginCookie);
+ const res = await douyinService.getCreatorItems(
+ cookie,
+ '11111',
+ cookie.msToken,
+ );
+
+ console.log(res);
+
+ return res;
+ }
+}
diff --git a/electron/plat/douyin/douyin.type.ts b/electron/plat/douyin/douyin.type.ts
index 835fc3ed..52bbe49c 100644
--- a/electron/plat/douyin/douyin.type.ts
+++ b/electron/plat/douyin/douyin.type.ts
@@ -418,3 +418,28 @@ export interface DouyinCreatorListResponse {
}[];
total_count: number;
}
+
+// 抖音作品评论列表
+export interface DouyinCreatorCommentListResponse {
+ extra: Extra;
+ status_code: number; // 0
+ status_msg: string;
+ has_more: boolean;
+ item_info_list: {
+ anchor_user_id: string;
+ cursor: string;
+ comment_count: number; // 回复数量
+ cover_image_url: string; // 'https://p3-sign.douyinpic.com/c5d200033ae82940b280~tplv-dy-resize-walign-adapt-aq:540:q75.jpeg?lk3s=138a59ce&x-expires=1742889600&x-signature=jcYpgxENZDa38hHUHNFfpcAPUDs%3D&from=327834062&s=PackSourceEnum_PUBLISH&se=false&sc=cover&biz_tag=aweme_video&l=20250311165957E85797DDC3B0DA04AEBA';
+ create_time: string; // '发布于2018年09月23日 17:51';
+ creator_item_setting: {
+ charge_comment_audit: boolean; // 收费评论审计
+ };
+ duration: number;
+ item_id: string; // '@j/do779EQE//uctS8r3tvsx9pyuRYyn/J6krPKNgjq9hkia+W5A7RJEoPQpq6PZlQedr6LX3XaKU0Yc8jcykog==';
+ item_id_plain: string; // '6604355150884637966';
+ item_link: string; // 'https://www.iesdouyin.com/share/video/6604355150884637966/?region=CN&mid=6568746752824380174&u_code=16b4ji55k&did=MS4wLjABAAAANwkJuWIRFOzg5uCpDRpMj4OX-QryoDgn-yYlXQnRwQQ&iid=MS4wLjABAAAANwkJuWIRFOzg5uCpDRpMj4OX-QryoDgn-yYlXQnRwQQ&with_sec_did=1&video_share_track_ver=&titleType=&share_sign=qwbHwbUn9.rqVOBIpmIak8F4W9CXvvE18GzpMaAUfyU-&share_version=210100&ts=1741683597&from_aid=1128&from_ssr=1';
+ media_type: number; // 4;
+ title: string; // '';
+ }[];
+ total_count: number;
+}
diff --git a/electron/plat/douyin/index.ts b/electron/plat/douyin/index.ts
index 93e99fe1..ecb23531 100644
--- a/electron/plat/douyin/index.ts
+++ b/electron/plat/douyin/index.ts
@@ -12,6 +12,7 @@ import {
DouyinActivityListResponse,
DouyinActivityTagsResponse,
DouyinAllHotDataResponse,
+ DouyinCreatorCommentListResponse,
DouyinCreatorListResponse,
DouyinHotDataResponse,
DouyinLocationDataResponse,
@@ -2143,10 +2144,19 @@ export class DouyinService {
});
}
- // 查询抖音的活动列表
- async getCreatorItems(cookie: Electron.Cookie[]) {
+ /**
+ * 查询抖音的活动列表
+ * @param cookie
+ * @param msToken
+ * @returns
+ */
+ async getCreatorItems(
+ cookie: Electron.Cookie[],
+ cursor: string,
+ msToken: string,
+ ) {
return await requestNet<DouyinCreatorListResponse>({
- url: `https://creator.douyin.com/aweme/v1/creator/item/list/?cursor=1541234344000&msToken=Ebo-uQlPJr-ICq23I7VMTe0nwYlocnqE5RBduJUPnXAu4dBw4bcqAHYV8lMraGXmHY3Z4_wXGetYKGb9ag4N0qODk9BSHgoJ9BDcIkdCwulqmedq5hAXWUgfPjAmOa_9kk6FyQX517kYJJ5S_6ROqKtefK4r6-Cf7WRDWoKjVwCaGg%3D%3D&a_bogus=O60jDtUiOo8ca3KtYKd4H1elFldlNs8yZaTxRbUnH5nmTX0GVHe6Znb0cxKXpyld-YBnhCKHunT%2FPjdbK0siZ%2FHpKmZkSDzS4tAc9gvogqiDGei%2FLNRwCuDNtJtYUbTEOAKjJlf6WURO2dOUEN3wUB5yC%2FPq4QJpMNrbDdRaEoFv60s7FNFxuNSdPXMtU1IG`,
+ url: `https://creator.douyin.com/aweme/v1/creator/item/list/?cursor=${cursor}&msToken=${msToken}`,
headers: {
cookie: CookieToString(cookie),
},
@@ -2155,9 +2165,17 @@ export class DouyinService {
}
// 查看作品的评论列表
- async getCreatorCommentList(cookie: Electron.Cookie[]) {
- return await requestNet<DouyinCreatorListResponse>({
- url: `https://creator.douyin.com/aweme/v1/creator/comment/list/?cursor=0&count=10&item_id=%40j%2Fdo779EQE%2F%2FuctS8rzvvch6oCaTZCH0JqwsPqxpgahhkia%2BW5A7RJEoPQpq6PZl7wq9uxSqSWCjcIdbPzF8fQ%3D%3D&sort=TIME&msToken=yQqn99oxgrHKzHmripWPpKZLis4fCjPI_D8XoI42Ok_zdaAUG4O-y2lf7AxR_qcJ_AIDPOHMyta2NpMghNfYVRHRiLXqxBHaPyZsYVyMfegq4lmivibvZRhap9vug6MwDfLmwNLomzE_QyhImaiQ1UdbYElA_GSOyIYCtmqLt2h6HIIwXDwZey4%3D&a_bogus=Dy45hFUjOZ5RKpFtuOcaCaclmtoMrPuyaMTdR9Sn9xE3GHUYoNebZxcEcou1smczaupVhH37bVzlYxVc%2FskwZ%2FrpwmkvuTwfGzAC9gsoMqqDatGmErRTCzDNtJtb054EKQoRJIf6UU5OIx5UgN3hUQA9S%2FPo4YJpFHaWDQUaPozv6FG7BNq2uNtdTwFb5Q94jD%3D%3D`,
+ async getCreatorCommentList(
+ cookie: Electron.Cookie[],
+ item_id: string, // 作品ID
+ pageInfo: {
+ cursor: number;
+ count: number;
+ },
+ msToken: string,
+ ) {
+ return await requestNet<DouyinCreatorCommentListResponse>({
+ url: `https://creator.douyin.com/aweme/v1/creator/comment/list/?cursor=${pageInfo.cursor}&count=${pageInfo.count}&item_id=${item_id}&sort=TIME&msToken=${msToken}`,
headers: {
cookie: CookieToString(cookie),
},
diff --git a/src/icp/reply.ts b/src/icp/reply.ts
new file mode 100644
index 00000000..76f45a63
--- /dev/null
+++ b/src/icp/reply.ts
@@ -0,0 +1,15 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-01-23 15:48:14
+ * @LastEditTime: 2025-02-14 22:36:25
+ * @LastEditors: nevin
+ * @Description:
+ */
+
+/**
+ * 获取作品列表
+ */
+export async function ipcCreatorList() {
+ const res = await window.ipcRenderer.invoke('ICP_CREATOR_LIST');
+ return res;
+}
diff --git a/src/router/index.tsx b/src/router/index.tsx
index 0d8b68de..4f5a7639 100644
--- a/src/router/index.tsx
+++ b/src/router/index.tsx
@@ -42,6 +42,7 @@ import Task from '@/views/task';
import UserWalletAccount from '@/views/finance/userWalletAccount';
import Finance from '@/views/finance/index';
import UserWalletRecord from '@/views/finance/userWalletRecord';
+import Reply from '@/views/reply';
interface IRouterMeta {
// 路由名称
@@ -114,6 +115,11 @@ export const router: CustomRouteObject[] = [
{ path: 'drafts', element: <Drafts /> },
],
},
+ {
+ path: '/reply',
+ element: <Reply />,
+ meta: { name: '评论', icon: UserOutlined },
+ },
{
path: '/statistics',
element: <Statistics />,
diff --git a/src/views/reply/index.tsx b/src/views/reply/index.tsx
index 7e32c088..4778da9a 100644
--- a/src/views/reply/index.tsx
+++ b/src/views/reply/index.tsx
@@ -3,11 +3,26 @@
* @Date: 2025-02-10 22:20:15
* @LastEditTime: 2025-02-28 21:36:53
* @LastEditors: nevin
- * @Description: 评论页面
+ * @Description: 评论页面 reply
*/
+import { ipcCreatorList } from '@/icp/reply';
+import { Button } from 'antd';
import { useState } from 'react';
export default function Page() {
const [activeTab, setActiveTab] = useState('car');
- return <div>111</div>;
+ async function getCreatorList() {
+ const res = await ipcCreatorList();
+ console.log('----- res', res);
+ }
+
+ return (
+ <div>
+ <div>
+ <Button type="primary" onClick={getCreatorList}>
+ 获取列表
+ </Button>
+ </div>
+ </div>
+ );
}