Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
小红书搜索
DESKTOP-ZTS2NQJNAfddaa19d7df8
diff --git a/electron/main/plat/PlatformBase.ts b/electron/main/plat/PlatformBase.tsindex 88c3b880..c0857a24 100644--- a/electron/main/plat/PlatformBase.ts+++ b/electron/main/plat/PlatformBase.ts@@ -114,11 +114,13 @@ export abstract class PlatformBase {/*** 搜索作品* @param account 账户- * @param pcursor 分页游标+ * @param qe 搜索关键词+ * @param pageInfo 分页信息*/abstract getsearchNodeList(account: AccountModel,- pcursor?: string,+ qe?: string,+ pageInfo?:any): Promise<{list: WorkData[];pageInfo: ResponsePageInfo;diff --git a/electron/main/plat/index.ts b/electron/main/plat/index.tsindex 0fc8ea03..4897067f 100644--- a/electron/main/plat/index.ts+++ b/electron/main/plat/index.ts@@ -213,9 +213,9 @@ class PlatController {* @param account* @param pcursor*/- public async getsearchNodeList(account: AccountModel, pcursor?: string) {+ public async getsearchNodeList(account: AccountModel, qe?: string,pageInfo?:any) {const platform = this.platforms.get(account.type)!;- return await platform.getsearchNodeList(account, pcursor);+ return await platform.getsearchNodeList(account, qe,pageInfo);}/**diff --git a/electron/main/plat/plat.type.ts b/electron/main/plat/plat.type.tsindex 3c3af72d..9860b6c9 100644--- a/electron/main/plat/plat.type.ts+++ b/electron/main/plat/plat.type.ts@@ -59,6 +59,11 @@ export type WorkData = {option?: {xsec_token: string;};+ author?: {+ name: string;+ avatar: string;+ };+ data?: any;};// 评论diff --git a/electron/main/plat/platforms/xhs/index.ts b/electron/main/plat/platforms/xhs/index.tsindex 29f0758e..0749403b 100644--- a/electron/main/plat/platforms/xhs/index.ts+++ b/electron/main/plat/platforms/xhs/index.ts@@ -135,6 +135,55 @@ export class Xhs extends PlatformBase {return res;}+ /**+ * 搜索作品列表+ * @param account+ * @param pcursor+ * @returns+ */+ async getsearchNodeList(account: AccountModel, qe?: string,pageInfo?:any) {+ const pageNo = pageInfo ? Number.parseInt(pageInfo.pcursor) : 0;++ const pageSize = 20;++ const cookie: CookiesType = JSON.parse(account.loginCookie);+ const res = await xiaohongshuService.getSearchNodeList(+ CookieToString(cookie),+ qe || '',+ pageNo,+ );+ console.log('------ getsearchNodeList xhs res---', res.data.data.items[0].note_card);++ const list:WorkData[] = res.data.data.items.map((v:any) => ({+ dataId: v.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.note_card?.display_title,+ coverUrl: v.note_card?.cover.url_default || '',+ option: {+ xsec_token: v.xsec_token,+ },+ author: {+ name: v.note_card?.user?.nickname,+ avatar: v.note_card?.user?.avatar,+ },+ data: v,+ }));++ const count = res.data.data?.tags?.[0]?.notes_count || 0;+ const hasMore = res.data.data.has_more;+ return {+ list,+ pageInfo: {+ count,+ hasMore,+ pcursor: hasMore ? pageNo + 1 + '' : '',+ },+ };+ }+/*** 获取作品列表* @param accountdiff --git a/electron/main/reply/controller.ts b/electron/main/reply/controller.tsindex 7cde4210..fca9d110 100644--- a/electron/main/reply/controller.ts+++ b/electron/main/reply/controller.ts@@ -101,6 +101,7 @@ export class ReplyController {event: Electron.IpcMainInvokeEvent,accountId: number,qe?: string,+ pageInfo?:any) {const account = await this.accountService.getAccountById(accountId);@@ -110,7 +111,7 @@ export class ReplyController {count: 0,};- const res = await platController.getsearchNodeList(account, qe);+ const res = await platController.getsearchNodeList(account, qe,pageInfo);return res;}diff --git a/electron/plat/Kwai/index.ts b/electron/plat/Kwai/index.tsindex e6903959..c9ae20df 100644--- a/electron/plat/Kwai/index.ts+++ b/electron/plat/Kwai/index.ts@@ -100,7 +100,7 @@ class KwaiPub {// 监听 URL 跳转(导航)事件mainWindow.webContents.on('did-navigate', async () => {const cookies = await mainWindow.webContents.session.cookies.get({- // url: 'https://id.kuaishou.com/pass/kuaishou/login/passToken?sid=kuaishou.web.cp.api',+ url: 'https://id.kuaishou.com/pass/kuaishou/login/passToken?sid=kuaishou.web.cp.api',});// 存在关键cookieif (cookies.some((v) => v.name === 'passToken')) {diff --git a/electron/plat/xiaohongshu/index.ts b/electron/plat/xiaohongshu/index.tsindex f1eac7bd..64c74814 100644--- a/electron/plat/xiaohongshu/index.ts+++ b/electron/plat/xiaohongshu/index.ts@@ -1376,6 +1376,44 @@ export class XiaohongshuService {});}+ // 获取作品列表+ async getSearchNodeList(cookie: string, qe: string, page: number = 0) {+ const url = `/api/sns/web/v1/search/notes`;+ const body =+ {"keyword":"猫咪",+ "page":1,+ "page_size":20,+ "search_id":"2em3pesjyckq6kdr2n6mt",+ "sort":"general","note_type":0,"ext_flags":[],"geo":"",+ "filters":[{"tags":["general"],"type":"sort_type"},+ {"tags":["不限"],"type":"filter_note_type"},{"tags":["不限"],"type":"filter_note_time"},+ {"tags":["不限"],"type":"filter_note_range"},{"tags":["不限"],"type":"filter_pos_distance"}],+ "image_formats":["jpg","webp","avif"]+ }++ const reverseRes: any = await this.getReverseResult({+ url,+ a1: cookie,+ data: body+ });++ const res = await requestNet<any>({+ url: `https://edith.xiaohongshu.com${url}`,+ headers: {+ cookie: cookie,+ Referer: this.loginUrl,+ origin: this.loginUrl,+ '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: body+ });++ return res;+ }+// 获取作品列表async getWorks(cookie: string, page: number = 0) {const url = `/web_api/sns/v5/creator/note/user/posted?tab=0&page=${page}`;diff --git a/src/icp/replyother.ts b/src/icp/replyother.tsindex 8cf906e2..50add778 100644--- a/src/icp/replyother.ts+++ b/src/icp/replyother.ts@@ -83,7 +83,7 @@ export async function icpCreatorList(accountId: number, pcursor?: string) {/*** 搜索各平台内容*/-export async function getCommentSearchNotes(accountId: number, qe?: string) {+export async function getCommentSearchNotes(accountId: number, qe?: string,pageInfo?:any) {const res: {list: WorkData[];pageInfo: {@@ -92,7 +92,7 @@ export async function getCommentSearchNotes(accountId: number, qe?: string) {hasMore?: boolean;pcursor?: string;};- } = await window.ipcRenderer.invoke('ICP_SEARCH_NODE_LIST', accountId, qe);+ } = await window.ipcRenderer.invoke('ICP_SEARCH_NODE_LIST', accountId, qe,pageInfo);return res;}diff --git a/src/views/replyother/index.tsx b/src/views/replyother/index.tsxindex 95d26f12..7a976657 100644--- a/src/views/replyother/index.tsx+++ b/src/views/replyother/index.tsx@@ -78,6 +78,14 @@ export default function Page() {const [webviewModalVisible, setWebviewModalVisible] = useState(false);const [currentUrl, setCurrentUrl] = useState('');const [isWebviewLoading, setIsWebviewLoading] = useState(true);+ const [pageInfo, setPageInfo] = useState<{+ count: number;+ hasMore: boolean;+ pcursor?: string;+ }>({+ count: 0,+ hasMore: false,+ });// 创建 webview 的引用const webviewRef = useRef<any>(null);@@ -187,12 +195,15 @@ export default function Page() {}-- async function getSearchListFunc(thisid:any, qe?:any) {+// 搜索列表 - 平台自己搜索+ async function getSearchListFunc(thisid:any, qe?:any,pageInfo?:any) {setPostList([])- const res = await getCommentSearchNotes(thisid,qe)+ const res = await getCommentSearchNotes(thisid,qe,pageInfo)console.log('------ getSearchListFunc', res)- setPostList(res)+ if(res.list.length){+ setPostList(res.list)+ }+}async function getFwqCreatorList() {@@ -515,7 +526,8 @@ export default function Page() {setActiveAccountType(info.type);if (info.type == 'xhs') {setActiveAccountId(info.id);- getFwqCreatorList();+ // getFwqCreatorList();+ getSearchListFunc(info.id);} else if(info.type == 'KWAI'){setActiveAccountId(info.id);getSearchListFunc(info.id);@@ -569,7 +581,7 @@ export default function Page() {><imgalt={item.title}- src={item.cover}+ src={item.coverUrl}style={{width: '100%',borderRadius: '10px 10px 0 0',@@ -590,11 +602,11 @@ export default function Page() {: undefined,}}/>- <span>{item.stats?.likeCount || 0}</span>+ <span>{item.likeCount || 0}</span></Space>,<Space onClick={() => showCommentModal(item)}><UnorderedListOutlined />- <span>列表</span>+ <span>{item.commentCount || 0}</span></Space>,<Space onClick={() => openReplyWorks(item)}><CommentOutlined />@@ -611,7 +623,7 @@ export default function Page() {: undefined,}}/>- <span>{item.stats?.collectCount || 0}</span>+ <span>{item.collectCount || 0}</span></Space>,]}>