Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
fix: 小红书登录检测修复,小红书登录检测凭借获取创作者中心的用户信息来判断,但是小红书前台过期了创作者中心未过期,所以需要以创作者中心为锚点判罚
gaoSir97d827f0119b
diff --git a/demo/kwai/index.html b/demo/kwai/index.htmlnew file mode 100644index 00000000..59a85c48--- /dev/null+++ b/demo/kwai/index.html@@ -0,0 +1,13 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <title>Title</title>+</head>+<body>+ <script>+ const appId = "ks715790869885446758";+ const appSecret = "cqSvJvBSPJjd-4pBH_4N0Q";+ </script>+</body>+</html>\ No newline at end of filediff --git a/electron/plat/shipinhao/index.ts b/electron/plat/shipinhao/index.tsindex 5a91b40c..0e447a81 100644--- a/electron/plat/shipinhao/index.ts+++ b/electron/plat/shipinhao/index.ts@@ -1118,8 +1118,8 @@ export class ShipinhaoService {) {reject('发布失败,失败原因:' + createRes.data.baseResp.errmsg);} else {- const lastPublishId = await this.getLastPublishId(cookieString);- resolve(lastPublishId);+ const lastWorkInfo = await this.getLastPublishId(cookieString);+ resolve(lastWorkInfo.lastPublishId);}} catch (err: any) {let errorMessage;@@ -1138,7 +1138,10 @@ export class ShipinhaoService {/*** 获取用户视频列表最后一条发布的视频Id*/- private async getLastPublishId(cookieString: string): Promise<string> {+ private async getLastPublishId(cookieString: string): Promise<{+ lastPublishId: string;+ previewVideoLink: string;+ }> {const workListRes = await this.makeRequest(this.getUserWorkListUrl, {method: 'POST',headers: {@@ -1155,14 +1158,40 @@ export class ShipinhaoService {},});- let lastPublishId = '';+ let work;if (workListRes.errCode === 0) {const workList = workListRes.data.list;if (workList.length > 0) {- lastPublishId = workList[0].desc.media[0].md5sum ?? '';+ work = workList[0];}}- return lastPublishId;++ // 获取预览的视频链接+ // const previewVideoRes = await this.makeRequest(+ // 'https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/post/get_object_short_link',+ // {+ // method: 'POST',+ // headers: {+ // Cookie: cookieString,+ // 'Content-Type': 'application/json',+ // },+ // data: {},+ // },+ // );++ // let lastPublishId = '';+ // if (workListRes.errCode === 0) {+ // const workList = workListRes.data.list;+ // if (workList.length > 0) {+ // lastPublishId = workList[0].desc.media[0].md5sum ?? '';+ // }+ // }+ return {+ lastPublishId: work?.desc?.media[0]?.md5sum ?? '',+ previewVideoLink: ''+ // previewVideoLink: {+ // }+ };}/**diff --git a/electron/plat/xiaohongshu/index.ts b/electron/plat/xiaohongshu/index.tsindex b89a623d..a2509c41 100644--- a/electron/plat/xiaohongshu/index.ts+++ b/electron/plat/xiaohongshu/index.ts@@ -21,7 +21,7 @@ export class XiaohongshuService {private loginUrl = 'https://creator.xiaohongshu.com/';private loginUrlHome = 'https://www.xiaohongshu.com/';private getUserInfoUrl =- 'https://creator.xiaohongshu.com/api/galaxy/user/info';+ 'https://edith.xiaohongshu.com/api/sns/web/v2/user/me';private getDashboardUrl ='https://creator.xiaohongshu.com/api/galaxy/v2/creator/datacenter/account/base';private getFansInfoUrl =@@ -235,9 +235,9 @@ export class XiaohongshuService {});return {- authorId: userInfo.data.userId || '',- nickname: userInfo.data.userName || '',- avatar: userInfo.data.userAvatar || '',+ authorId: userInfo.data.user_id || '',+ nickname: userInfo.data.nickname || '',+ avatar: userInfo.data.imageb || '',fansCount: fansInfo.data.fans_count || 0,};}diff --git a/src/utils/videoPub.ts b/src/utils/videoPub.tsnew file mode 100644index 00000000..3713149b--- /dev/null+++ b/src/utils/videoPub.ts@@ -0,0 +1,19 @@+import { VideoPul } from '../views/publish/children/videoPage/comment';+import { AccountType } from '../../commont/AccountEnum';++/**+ * 获取视频发布预览的地址+ * @param videoRecord+ */+export function getVideoPreviewPage(videoRecord: VideoPul) {+ let url = '';+ switch (videoRecord.type) {+ case AccountType.Douyin:+ url = `https://www.douyin.com/user/self?from_tab_name=main&modal_id=${videoRecord.dataId}&showTab=post`;+ break;+ case AccountType.Xhs:+ url = `https://www.xiaohongshu.com/explore/${videoRecord.dataId}?xsec_token=${videoRecord.videoPubOtherData![AccountType.Xhs]!.xsec_token}&xsec_source=${videoRecord.videoPubOtherData![AccountType.Xhs]!.xsec_source}`;+ break;+ }+ return url;+}diff --git a/src/views/publish/children/pubRecord/page.tsx b/src/views/publish/children/pubRecord/page.tsxindex 940a1e73..2edbaed7 100644--- a/src/views/publish/children/pubRecord/page.tsx+++ b/src/views/publish/children/pubRecord/page.tsx@@ -23,6 +23,7 @@ import { useNavigate } from 'react-router-dom';import { AccountType } from '../../../../../commont/AccountEnum';import WebView from '../../../../components/WebView';import { getVideoFile } from '../../../../components/Choose/VideoChoose';+import { getVideoPreviewPage } from '../../../../utils/videoPub';const PubCon = ({ prm }: { prm: PubRecordModel }) => {const [imgFile, setImgFile] = useState<IImgFile>();@@ -263,12 +264,11 @@ export default function Page() {newState.open = true;newState.account = account;- if (account?.type === AccountType.Douyin) {- newState.url = `https://www.douyin.com/user/self?from_tab_name=main&modal_id=${v.dataId}&showTab=post`;- } else if (account?.type === AccountType.Xhs) {- newState.url = `https://www.xiaohongshu.com/explore/${v.dataId}?xsec_token=${v.videoPubOtherData![AccountType.Xhs]!.xsec_token}&xsec_source=${v.videoPubOtherData![AccountType.Xhs]!.xsec_source}`;- } else if (account?.type === AccountType.WxSph) {+ if (account?.type === AccountType.WxSph) {newState.videoSrc = videoFile.videoUrl;+ } else {+ newState.url = getVideoPreviewPage(v);+ console.log(newState.url);}return newState;});