Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
fix: 抖音参数调试中
gaoSir6df8e57c06d3
diff --git a/commont/publish/PublishEnum.ts b/commont/publish/PublishEnum.tsindex f57d14e3..ca5d3a3e 100644--- a/commont/publish/PublishEnum.ts+++ b/commont/publish/PublishEnum.ts@@ -7,11 +7,11 @@ export enum PubType {// 可见性export enum VisibleTypeEnum {// 所有人可见- Public = 0,+ Public = 1,// 仅自己可见- Private = 1,+ Private = 2,// 好友可见- Friend = 2,+ Friend = 3,}// 抖音自主声明diff --git a/electron/plat/douyin/index.ts b/electron/plat/douyin/index.tsindex 8058ab50..37220aea 100644--- a/electron/plat/douyin/index.ts+++ b/electron/plat/douyin/index.ts@@ -478,6 +478,8 @@ export class DouyinService {},callback: (progress: number, msg?: string) => void,): Promise<any> {+ console.log('开始发布视频作品,参数:', platformSetting);+return new Promise(async (resolve, reject) => {try {// 初始化cookie@@ -493,6 +495,7 @@ export class DouyinService {callback(15);console.log('获取到的用户Uid:', userUid);+ // 上传封面图片 获取封面图片poster参数值console.log('开始上传封面图片...');console.log('封面图片路径:', platformSetting.cover);const poster = await this.uploadCoverFile(@@ -529,7 +532,7 @@ export class DouyinService {`[${new Date().toLocaleString()}] 获取到的csrf-token:`,csrfToken,);- callback(70);+ callback(70, '正在发布...');// 获取bd-ticketconsole.log(`[${new Date().toLocaleString()}] 开始获取bd-ticket...`);@@ -548,7 +551,6 @@ export class DouyinService {`[${new Date().toLocaleString()}] 发布参数:`,publishVideoParams,);- callback(80, '正在发布...');const publishResult = await this.makePublishRequest(this.publishUrl, {method: 'POST',headers: {@@ -960,6 +962,10 @@ export class DouyinService {});request.on('response', (response) => {+ console.log(+ `收到响应 [${new Date().toLocaleString()}], 状态码:`,+ response.statusCode,+ );let data = '';response.on('data', (chunk) => {data += chunk;@@ -1671,7 +1677,7 @@ export class DouyinService {private getPublishPublicParams(platformSetting: any): any {console.log('开始处理发布参数...');// 处理标题- let text = platformSetting['desc'] ?? '';+ let text = platformSetting['title'] ?? '';// 标题扩展属性const textExtra = [];// @好友参数@@ -1844,6 +1850,7 @@ export class DouyinService {headers: headers,ok: response.ok,};+ // console.log('fffff',fft)return fft;} catch (error) {console.error('HEAD请求失败:', error);@@ -1877,6 +1884,8 @@ export class DouyinService {}const headers = csrfTokenRes.headers;+ // console.log('CSRF Token响应头:', headers);+if (!headers['x-ware-csrf-token']) {console.error('获取CSRF_TOKEN失败,响应头中没有x-ware-csrf-token');reject('获取CSRF_TOKEN失败,请稍后重试!');@@ -1945,6 +1954,10 @@ export class DouyinService {* 发布专用请求方法*/private async makePublishRequest(url: string, options: any): Promise<any> {+ console.log(`[${new Date().toLocaleString()}] 开始发起发布请求...`);+ console.log(`[${new Date().toLocaleString()}] 请求URL:`, url);+ console.log(`[${new Date().toLocaleString()}] 请求参数:`, options);+try {// 创建 FormData 对象const formData = new FormData();@@ -1959,6 +1972,11 @@ export class DouyinService {}});+ console.log(+ `[${new Date().toLocaleString()}] 请求体数据:`,+ Object.fromEntries(formData.entries()),+ );+const response = await fetch(url, {method: options.method,headers: {@@ -1967,7 +1985,25 @@ export class DouyinService {body: formData,});+ console.log(+ `[${new Date().toLocaleString()}] 收到响应,状态码:`,+ response.status,+ );+ console.log(+ `[${new Date().toLocaleString()}] 响应头:`,+ Object.fromEntries(response.headers.entries()),+ );+const responseText = await response.text();+ console.log(+ `[${new Date().toLocaleString()}] 原始响应数据长度:`,+ responseText.length,+ );+ console.log(+ `[${new Date().toLocaleString()}] 原始响应数据:`,+ responseText,+ );+// 检查响应数据是否为空if (!responseText || responseText.trim() === '') {console.error(`[${new Date().toLocaleString()}] 响应数据为空`);diff --git a/src/icp/publish.ts b/src/icp/publish.tsindex 4363bfa0..fce90c63 100644--- a/src/icp/publish.ts+++ b/src/icp/publish.ts@@ -39,7 +39,6 @@ export async function icpCreatePubRecord(pubRecord: Partial<PubRecordModel>) {// 创建视频发布记录export async function icpCreateVideoPubRecord(pubRecord: Partial<VideoPul>) {- console.log('发布参数:', pubRecord);const res: VideoPul = await window.ipcRenderer.invoke('ICP_PUBLISH_CREATE_VIDEO_PUL',pubRecord,diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsxindex d9cbc9de..148a6319 100644--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx@@ -192,6 +192,7 @@ const VideoPubSetModal = memo(const account = vData.account!;const video = vData.video!;await icpCreateVideoPubRecord({+ ...vData.pubParams,type: account.type,accountId: account.id,pubRecordId: recordRes.id,diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_WxSph.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_WxSph.tsxindex 65739ba4..f69ec288 100644--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_WxSph.tsx+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_WxSph.tsx@@ -56,7 +56,7 @@ const WXSphActivity = ({ currChooseAccount }: IVideoPubSetModalChildProps) => {filterOption={false}onSearch={debounceFetcher}notFoundContent={fetching ? <Spin size="small" /> : null}- options={options.map((v) => {+ options={options?.map((v) => {return {label: v.eventName,value: v.eventTopicId,diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/components/LocationSelect.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/components/LocationSelect.tsxindex e41b4db4..bb24f85c 100644--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/components/LocationSelect.tsx+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/components/LocationSelect.tsx@@ -49,8 +49,7 @@ export default function LocationSelect({}return [];}- console.log(locationData);- return locationData.data!;+ return locationData.data || [];});// 位置 0=经度 1=纬度const location = useRef<number[]>([]);@@ -77,7 +76,7 @@ export default function LocationSelect({onSearch={debounceFetcher}notFoundContent={fetching ? <Spin size="small" /> : null}{...props}- options={options.map((v) => {+ options={options?.map((v) => {return {value: v.id,label: v.name,@@ -93,10 +92,10 @@ export default function LocationSelect({);}}value={currChooseAccount.pubParams!.location as any}- onChange={(newValue) => {+ onChange={(_, value) => {setOnePubParams({- location: newValue || null,+ location: (value as ILocationDataItem) || null,},currChooseAccount.id,);