返回 Social Auto Upload
kuaishou_cli_template.py
根目录 / skills / kuaishou-upload / scripts / examples / kuaishou_cli_template.py
1 from __future__ import annotations
2
3 import shlex
4 import subprocess
5
6
7 def run_command(command: list[str]) -> None:
8 print("Running:", " ".join(shlex.quote(part) for part in command))
9 subprocess.run(command, check=True)
10
11
12 def main() -> None:
13 account = "account_a"
14 # account_name is user-defined. One account_name maps to one account file.
15 # You can prepare multiple account names and run them in parallel.
16
17 commands = [
18 ["sau", "kuaishou", "login", "--account", account],
19 ["sau", "kuaishou", "check", "--account", account],
20 [
21 "sau",
22 "kuaishou",
23 "upload-video",
24 "--account",
25 account,
26 "--file",
27 "videos/demo.mp4",
28 "--title",
29 "Kuaishou video from Python",
30 "--desc",
31 "Kuaishou video description from Python",
32 "--tags",
33 "cli,video",
34 "--thumbnail",
35 "videos/demo.png",
36 "--headless",
37 ],
38 [
39 "sau",
40 "kuaishou",
41 "upload-note",
42 "--account",
43 account,
44 "--images",
45 "videos/1.png",
46 "videos/2.png",
47 "videos/3.png",
48 "--title",
49 "Kuaishou note title from Python",
50 "--note",
51 "Kuaishou note from Python",
52 "--tags",
53 "cli,note",
54 "--headless",
55 ],
56 ]
57
58 for command in commands:
59 run_command(command)
60
61
62 if __name__ == "__main__":
63 main()
64
64 lines PYTHON