fix: TikTok 2158 限流时给出明确提示,避免连点加重封禁
账号因短时间大量发布被 TikTok 拒绝,错误改为中文说明并要求等待。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
dfdd2c539c
commit
dcead62399
@ -22,6 +22,19 @@ def _privacy_to_visibility(privacy_level: str) -> int:
|
||||
return 0
|
||||
|
||||
|
||||
def _friendly_upload_error(log: str) -> str:
|
||||
text = str(log or "")
|
||||
low = text.lower()
|
||||
if "2158" in text or "posting videos too fast" in low or "take a rest" in low:
|
||||
return "TikTok 限流:发得太快(status 2158)。请至少等几小时后再手动传 1 条,不要连点"
|
||||
if "login expired" in low or '"status_code": 8' in text:
|
||||
return "TikTok Cookie 已过期,请重新粘贴 sessionid"
|
||||
if "invalid parameters" in low:
|
||||
return "TikTok 拒绝发布参数,请稍后重试 1 次"
|
||||
tail = " ".join(line.strip() for line in text.strip().splitlines()[-4:] if line.strip())[:240]
|
||||
return tail or "TikTok 上传失败"
|
||||
|
||||
|
||||
def _upload_sync(
|
||||
*,
|
||||
channel_pk: str,
|
||||
@ -93,10 +106,7 @@ def _upload_sync(
|
||||
"privacy_level": privacy_level,
|
||||
"dc_id": working_dc,
|
||||
}
|
||||
tail = " ".join(line.strip() for line in log.strip().splitlines()[-4:] if line.strip())[:240]
|
||||
raise ValueError(
|
||||
tail or "TikTok 上传失败,请检查 Cookie 是否过期或 Node.js 是否可用"
|
||||
)
|
||||
raise ValueError(_friendly_upload_error(log))
|
||||
|
||||
|
||||
async def upload_tiktok_mp4(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user