From 2c2aea32fe829d83cf882b82eda9c40840efc35b Mon Sep 17 00:00:00 2001 From: billy Date: Mon, 15 Jun 2026 15:31:03 +0800 Subject: [PATCH] =?UTF-8?q?feat(douyin):=E6=96=B0=E5=A2=9E--notef=E5=8F=82?= =?UTF-8?q?=E6=95=B0=EF=BC=8C=E6=94=AF=E6=8C=81=E4=BB=8Etxt/md=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=AF=BB=E5=8F=96=E6=AD=A3=E6=96=87=E9=A2=84=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/install.md | 3 +++ sau_cli.py | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) 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,