diff --git a/docs/install.md b/docs/install.md index 6ad97a0..f028478 100644 --- a/docs/install.md +++ b/docs/install.md @@ -103,8 +103,11 @@ sau bilibili --help sau douyin login --account sau douyin check --account sau douyin upload-video --account --file videos/demo.mp4 --title "示例标题" --desc "示例简介" +图文正文1: $noteText = @"图文正文"@ sau douyin upload-note --account --images videos/demo1.png videos/demo2.png --title "图文标题" --note $noteText --tags 'tag1,tag2' +图文正文2: +sau douyin upload-note --account --images videos/demo1.png videos/demo2.png --title "图文标题" --notef '图文文件路径' --tags 'tag1,tag2' ``` 抖音卡login手动获取cookie: diff --git a/sau_cli.py b/sau_cli.py index b4152aa..73cb298 100644 --- a/sau_cli.py +++ b/sau_cli.py @@ -547,6 +547,7 @@ def build_parser() -> argparse.ArgumentParser: upload_note_parser.add_argument("--images", required=True, nargs="+", type=existing_file_path, help="Image file paths") upload_note_parser.add_argument("--title", required=True, help="Note title") upload_note_parser.add_argument("--note", default="", help="Optional note content") + upload_note_parser.add_argument("--notef", default="", help="Read note content from file (txt/md)") upload_note_parser.add_argument("--tags", default="", help="Comma-separated tags, such as tag1,tag2") upload_note_parser.add_argument("--schedule", type=schedule_value, help=f"Schedule time in {schedule_help}") add_runtime_flags(upload_note_parser) @@ -687,11 +688,20 @@ async def dispatch(args: argparse.Namespace) -> int: return 0 if args.action == "upload-note": + # 如果指定了 --notef,读取文件内容作为 note + note_content = args.note + if args.notef: + note_file = Path(args.notef) + if not note_file.exists(): + print(f"错误:文件不存在: {note_file}", file=sys.stderr) + return 1 + note_content = note_file.read_text(encoding="utf-8") + request = DouyinNoteUploadRequest( account_name=args.account, image_files=parse_image_files(args.images), title=args.title, - note=args.note, + note=note_content, tags=parse_tags(args.tags), publish_date=args.schedule or 0, publish_strategy=publish_strategy,