Skip to content

Let's use AI to Earn!

i1d2-y

DESKTOP-ZTS2NQJNAccff3db46bfc
diff --git a/electron/main/plat/PlatformBase.ts b/electron/main/plat/PlatformBase.ts
index 0da84f6e..447215e4 100644
--- a/electron/main/plat/PlatformBase.ts
+++ b/electron/main/plat/PlatformBase.ts
@@ -170,6 +170,7 @@ export abstract class PlatformBase {
pcursor?: string,
): Promise<{
list: CommentData[];
+ orgList?: any;
pageInfo: ResponsePageInfo;
}>;
diff --git a/electron/main/plat/platforms/douyin/index.ts b/electron/main/plat/platforms/douyin/index.ts
index d51e5e78..1ba0f84f 100644
--- a/electron/main/plat/platforms/douyin/index.ts
+++ b/electron/main/plat/platforms/douyin/index.ts
@@ -204,6 +204,7 @@ export class Douyin extends PlatformBase {
const res = await douyinService.getSearchNodeList(cookie, qe, {
count: pageInfo.count,
pcursor: pageInfo.pcursor,
+ postFirstId: pageInfo.postFirstId,
});
const list: WorkData[] = [];
@@ -234,6 +235,7 @@ export class Douyin extends PlatformBase {
console.log('------douyin getsearchNodeList !!res.data.has_more^^: ', !!res.data.has_more);
return {
list,
+ orgList: res.data,
pageInfo: {
count: pageInfo.pcursor,
pcursor: res.data.cursor + '',
diff --git a/electron/plat/douyin/index.ts b/electron/plat/douyin/index.ts
index ad8c406d..18d532d0 100644
--- a/electron/plat/douyin/index.ts
+++ b/electron/plat/douyin/index.ts
@@ -2218,17 +2218,23 @@ export class DouyinService {
pageInfo: {
pcursor?: string;
count?: number;
+ postFirstId?: string;
},
) {
let pcursor = (pageInfo.pcursor && Number(pageInfo.pcursor) < 16) ? 0 : pageInfo.pcursor;
let count = (Number(pcursor) > 10) ? 10 : 16;
+
+ let gets:any = {
+ aid: '6383',
+ keyword: qe,
+ offset: pcursor,
+ count: count
+ }
+ if(pageInfo.postFirstId){
+ gets.search_id = pageInfo.postFirstId;
+ }
const thisUri = `https://www.douyin.com/aweme/v1/web/search/item/?${jsonToQueryString(
- {
- aid: '6383',
- keyword: qe,
- offset: pcursor,
- count: count
- }
+ gets
)}`;
console.log('------douyin getsearchNodeList uri: ', thisUri);
diff --git a/src/icp/replyother.ts b/src/icp/replyother.ts
index 586591d2..ed2045c1 100644
--- a/src/icp/replyother.ts
+++ b/src/icp/replyother.ts
@@ -89,6 +89,7 @@ export async function getCommentSearchNotes(
) {
const res: {
list: WorkData[];
+ orgList?: any;
pageInfo: {
pageType: PageType;
count?: number;
diff --git a/src/views/replyother/index.tsx b/src/views/replyother/index.tsx
index d2dff0d3..e7376630 100644
--- a/src/views/replyother/index.tsx
+++ b/src/views/replyother/index.tsx
@@ -64,8 +64,7 @@ import { useInView } from 'react-intersection-observer';
export default function Page() {
const [wordList, setWordList] = useState<WorkData[]>([]);
- const [commentList, setCommentList] = useState<CommentData[]>([]);
- const [secondCommentList, setSecondCommentList] = useState<any[]>([]);
+ const [postFirstId, setPostFirstId] = useState<string>('');
const [activeAccountId, setActiveAccountId] = useState<number>(-1);
const [activeAccountType, setActiveAccountType] = useState<string>('');
const [activeAccount, setActiveAccount] = useState<AccountModel>();
@@ -159,7 +158,9 @@ export default function Page() {
// 加载更多帖子
const loadMorePosts = async () => {
- if (!pageInfo.hasMore || isLoadingMore) return;
+ if (!pageInfo.hasMore || isLoadingMore ) return;
+
+ if(!postFirstId || postFirstId == '') return;
setIsLoadingMore(true);
try {
@@ -229,14 +230,17 @@ export default function Page() {
}
// 搜索列表 - 平台自己搜索
- async function getSearchListFunc(thisid: any, qe?: any) {
- if (!pageInfo.hasMore && pageInfo.pcursor !== 1) {
+ async function getSearchListFunc(thisid: any, qe?: any, isfirst?: boolean) {
+ if (!pageInfo.hasMore && pageInfo.pcursor !== 1 && !isfirst) {
console.log('没有更多数据了,不再发送请求');
return;
}
- const res = await getCommentSearchNotes(thisid, qe, pageInfo);
+ const res = await getCommentSearchNotes(thisid, qe, {...pageInfo, postFirstId: postFirstId});
console.log('------ getSearchListFunc -- @@:', res);
+ if (isfirst && activeAccountType == 'douyin') {
+ setPostFirstId(res.orgList?.log_pb?.impr_id);
+ }
if (res.list?.length) {
// 如果是加载更多,则追加到现有列表
setPostList((prev) => (pageInfo.pcursor !== 1 ? [...prev, ...res.list] : res.list));
@@ -283,26 +287,6 @@ export default function Page() {
setPostList(newlist || []);
}
- /**
- * 获取评论列表
- */
- async function getCommentList(dataId: string) {
- // 7483006686274374962 7478960244136086784
- const res = await icpGetCommentListByOther(
- activeAccountId,
- // '7480598266392972596',
- {
- dataId: '678ce103000000001803c791',
- option: {
- xsec_token: 'AB-ktiN49qUSB2KL_4EN5bIQSRgCJR_AB1qIv8wAQvj94=',
- },
- },
- );
- console.log('------ icpGetCommentList', res);
-
- setCommentList(res.list);
- }
-
/**
* 获取二级评论列表
*/
@@ -575,7 +559,9 @@ export default function Page() {
});
// 执行搜索
- getSearchListFunc(activeAccountId, searchKeyword);
+ setTimeout(() => {
+ getSearchListFunc(activeAccountId, searchKeyword, true);
+ }, 500);
};
return (
@@ -600,7 +586,7 @@ export default function Page() {
setActiveAccountId(info.id);
setTimeout(() => {
- getSearchListFunc(info.id, searchKeyword);
+ getSearchListFunc(info.id, searchKeyword, true);
}, 0);
},