Skip to content

Let's use AI to Earn!

抖音搜索

DESKTOP-ZTS2NQJNAe231acd78d0a
diff --git a/electron/main/plat/plat.type.ts b/electron/main/plat/plat.type.ts
index 9860b6c9..bc1d7d50 100644
--- a/electron/main/plat/plat.type.ts
+++ b/electron/main/plat/plat.type.ts
@@ -61,6 +61,7 @@ export type WorkData = {
};
author?: {
name: string;
+ id?: string;
avatar: string;
};
data?: any;
diff --git a/electron/main/plat/platforms/douyin/index.ts b/electron/main/plat/platforms/douyin/index.ts
index 721fc6b9..3149c4ca 100644
--- a/electron/main/plat/platforms/douyin/index.ts
+++ b/electron/main/plat/platforms/douyin/index.ts
@@ -188,6 +188,59 @@ export class Douyin extends PlatformBase {
};
}
+ /**
+ * 获取搜索作品列表
+ * @param account
+ * @param data
+ * @param pcursor
+ * @returns
+ */
+ async getsearchNodeList(
+ account: AccountModel,
+ qe: string,
+ pageInfo?: any,
+ ) {
+ const cookie: CookiesType = JSON.parse(account.loginCookie);
+ const res = await douyinService.getSearchNodeList(cookie, qe, {
+ count: pageInfo.count,
+ pcursor: pageInfo.pcursor,
+ });
+
+ const list: WorkData[] = [];
+ // console.log('------douyin getsearchNodeList res: ', res);
+ console.log('------douyin getsearchNodeList res.data.cursor: ', res.data.cursor);
+ for (const s of res.data.data) {
+ let v = s.aweme_info;
+ list.push({
+ dataId: v.aweme_id,
+ readCount: v.note_card?.interact_info?.view_count,
+ likeCount: v.note_card?.interact_info?.liked_count,
+ collectCount: v.note_card?.interact_info?.collected_count,
+ commentCount: v.note_card?.interact_info?.comment_count,
+ title: v.desc,
+ coverUrl: v.video.cover.url_list[0] || '',
+ option: {
+ xsec_token: v.xsec_token || '',
+ },
+ author: {
+ name: v.author?.nickname,
+ id: v.author?.uid,
+ avatar: v.author?.avatar_thumb.uri,
+ },
+ data: v,
+ });
+ }
+
+ return {
+ list,
+ pageInfo: {
+ count: pageInfo.pcursor,
+ pcursor: res.data.cursor + '',
+ hasMore: !!res.data.has_more,
+ },
+ };
+ }
+
/**
* 获取评论列表
* @param account
@@ -614,15 +667,7 @@ export class Douyin extends PlatformBase {
};
}
- getsearchNodeList(
- account: AccountModel,
- pcursor?: string,
- ): Promise<{
- list: WorkData[];
- pageInfo: ResponsePageInfo;
- }> {
- throw '无此方法';
- }
+
}
const douyin = new Douyin();
diff --git a/electron/plat/douyin/index.ts b/electron/plat/douyin/index.ts
index 5c662da9..f364ada6 100644
--- a/electron/plat/douyin/index.ts
+++ b/electron/plat/douyin/index.ts
@@ -2211,6 +2211,36 @@ export class DouyinService {
return res;
}
+ // 获取搜索作品列表
+ async getSearchNodeList(
+ cookie: Electron.Cookie[],
+ qe: string, // 搜索关键词
+ pageInfo: {
+ pcursor?: string;
+ count?: number;
+ },
+ ) {
+ let pcursor = (pageInfo.pcursor && Number(pageInfo.pcursor) < 16) ? 0 : pageInfo.pcursor;
+ const thisUri = `https://www.douyin.com/aweme/v1/web/search/item/?${jsonToQueryString(
+ {
+ aid: '1',
+ keyword: qe,
+ offset: pcursor,
+ count: 16,
+ },
+ )}`;
+ console.log('------douyin getsearchNodeList uri: ', thisUri);
+ const res = await requestNet<any>({
+ url: thisUri,
+ headers: {
+ cookie: CookieToString(cookie),
+ },
+ method: 'GET',
+ });
+ console.log('------douyin getsearchNodeList res: ', res);
+ return res;
+ }
+
// 查看作品的评论列表
async getCreatorCommentList(
cookie: Electron.Cookie[],
diff --git a/electron/plat/xiaohongshu/index.ts b/electron/plat/xiaohongshu/index.ts
index 20975d98..9e9d983c 100644
--- a/electron/plat/xiaohongshu/index.ts
+++ b/electron/plat/xiaohongshu/index.ts
@@ -1388,7 +1388,7 @@ export class XiaohongshuService {
return (a <<= BigInt(64)), (a += u).toString(36);
}
- console.log('------ getSearchNodeList --- asdadsda::', qe, page, l());
+ console.log('------ getSearchNodeList --- asdadsda::', qe, page);
const body = {
keyword: '大象',
page: page,
@@ -1513,7 +1513,7 @@ export class XiaohongshuService {
method: 'GET',
});
- console.log('------- xhs getCommentList ---', res);
+ // console.log('------- xhs getCommentList ---', res);
return res;
}
diff --git a/src/views/replyother/index.tsx b/src/views/replyother/index.tsx
index 99e55fca..45fa6a9e 100644
--- a/src/views/replyother/index.tsx
+++ b/src/views/replyother/index.tsx
@@ -559,13 +559,16 @@ export default function Page() {
console.log('------ onAccountChange', info);
setActiveAccount(info);
setActiveAccountType(info.type);
- if (info.type == 'xhs') {
- setPostList([]);
+
+ setPostList([]);
setPageInfo({
count: 0,
hasMore: false,
pcursor: 1,
});
+
+ if (info.type == 'xhs') {
+
setActiveAccountId(info.id);
setTimeout(() => {
getSearchListFunc(info.id);
@@ -573,9 +576,10 @@ export default function Page() {
} else if (info.type == 'KWAI') {
setActiveAccountId(info.id);
getSearchListFunc(info.id);
- } else {
+ } else if (info.type == 'douyin') {
+ console.log('------ douyin kaihis ');
setActiveAccountId(info.id);
- getCreatorList(info.id);
+ getSearchListFunc(info.id, '英雄杀道一');
}
},
[getCreatorList],