fix(douyin): harden cover, collection and self-declaration flows

- Set cover via native click with retries; skip gracefully instead of failing the whole order
- Select the collection via its dedicated Semi select with overlay cleanup
- Rewrite self-declaration dialog handling (entry/dialog/option/confirm) and reuse it in upload
- Type description before tags and fill via set_input_files with robust upload input detection
- Keep SMS verification code prompt as a publish-loop guard
This commit is contained in:
suihf
2026-08-13 09:48:40 +08:00
parent 008e4ff66a
commit ad49ebae7a
2 changed files with 396 additions and 81 deletions
+4
View File
@@ -67,6 +67,7 @@ class DouyinVideoUploadRequest:
debug: bool = True
headless: bool = True
declaration: str | None = None
collection_name: str | None = None
@dataclass(slots=True)
@@ -359,6 +360,7 @@ async def upload_video(request: DouyinVideoUploadRequest) -> Path:
publish_strategy=request.publish_strategy,
debug=request.debug,
headless=request.headless,
collection_name=request.collection_name,
)
await app.douyin_upload_video()
return account_file
@@ -606,6 +608,7 @@ def build_parser() -> argparse.ArgumentParser:
"--declaration",
help="Exact Douyin self-declaration option text; omitted means do not set one",
)
upload_video_parser.add_argument("--collection", default=None, help="Optional collection name to add the work into (must already exist)")
add_runtime_flags(upload_video_parser)
upload_note_parser = douyin_actions.add_parser("upload-note", help="Upload one note to Douyin")
@@ -772,6 +775,7 @@ async def dispatch(args: argparse.Namespace) -> int:
publish_strategy=publish_strategy,
debug=args.debug,
headless=args.headless,
collection_name=args.collection,
)
await upload_video(request)
print(f"Douyin video upload submitted: {request.video_file}")