client_id / client_secret / 授权后的 access_token 填到下面。
填完即可在「内容生产」页点「发布 ▶」一键发到对应平台。' + j.video_file + '(' + j.size_mb + ' MB)封面:' + (j.cover_file || '自动抠') + '';
refreshUploads();
} else {
msg.textContent = '❌ ' + j.msg;
}
} catch (e) {
msg.textContent = '❌ ' + e;
}
}
async function refreshUploads() {
try {
const r = await fetch('/api/uploads/list');
const j = await r.json();
const el = $('#uploadsList');
if (!j.files || !j.files.length) { el.textContent = '(空)'; return; }
el.innerHTML = j.files.map(function(f){
return '';
}).join('');
} catch (e) {
$('#uploadsList').textContent = '刷新失败: ' + e;
}
}
async function quickPubKs(videoName) {
const caption = prompt('短视频描述(前 100 字内,作为快手 caption):', '星途京际留学咨询·0 语言基础工读直通版');
if (caption == null) return;
$('#uploadsList').textContent = '正在发快手:' + videoName + '…';
try {
const r = await fetch('/api/publish', {
method:'POST',
headers:{'Content-Type':'application/json'},
body: JSON.stringify({platforms:['kuaishou'], video_file: videoName, caption: caption})
});
const j = await r.json();
const ks = (j.results || {}).kuaishou || {};
if (ks.ok) {
alert('✅ 快手发布成功!\n' + (ks.msg || JSON.stringify(j)));
} else {
alert('❌ ' + (ks.msg || JSON.stringify(j)));
}
} catch (e) {
alert('❌ 调用失败: ' + e);
}
refreshUploads();
}
document.addEventListener('DOMContentLoaded', function(){
if (document.querySelector('[data-tab="pub"]')) refreshUploads();
});