返回 Social Auto Upload
bilibili_cli_template.py
根目录 / skills / bilibili-upload / scripts / examples / bilibili_cli_template.py
1 from __future__ import annotations
2
3 import subprocess
4 import sys
5 from pathlib import Path
6
7 from conf import BASE_DIR
8 from utils.constant import VideoZoneTypes
9
10
11 def main() -> None:
12 account = "account_a"
13 # account_name is user-defined. One account_name maps to one account file.
14 # You can prepare multiple account names and run them in parallel.
15 cli_path = Path(BASE_DIR) / "sau_cli.py"
16 command = [
17 sys.executable,
18 str(cli_path),
19 "bilibili",
20 "upload-video",
21 "--account",
22 account,
23 "--file",
24 str(Path(BASE_DIR) / "videos" / "demo.mp4"),
25 "--title",
26 "Bilibili CLI Demo",
27 "--desc",
28 "Bilibili CLI Demo",
29 "--tid",
30 str(VideoZoneTypes.SPORTS_FOOTBALL.value),
31 "--tags",
32 "足球,测试",
33 "--schedule",
34 "2026-03-26 16:00",
35 ]
36 subprocess.run(command, check=True)
37
38
39 if __name__ == "__main__":
40 main()
41
41 lines PYTHON