Track bundled vendor runtime sources
Some checks failed
CI / main (push) Has been cancelled
CI / release-e2e (push) Has been cancelled

This commit is contained in:
2026-07-07 10:05:50 +08:00
parent fbe179ab53
commit 52636c91ae
2111 changed files with 1850012 additions and 14 deletions

View File

View File

@@ -0,0 +1,10 @@
import asyncio
from pathlib import Path
from conf import BASE_DIR
from uploader.baijiahao_uploader.main import baijiahao_setup
if __name__ == '__main__':
account_file = Path(BASE_DIR / "cookies" / "baijiahao_uploader" / "account.json")
account_file.parent.mkdir(exist_ok=True)
cookie_setup = asyncio.run(baijiahao_setup(str(account_file), handle=True))

View File

@@ -0,0 +1,24 @@
from __future__ import annotations
import subprocess
import sys
from pathlib import Path
from conf import BASE_DIR
if __name__ == "__main__":
# 建议直接在本地真实终端里运行这个脚本。
# 如果终端里的二维码显示不完整,可以打开当前目录下的 qrcode.png 扫码。
cli_path = Path(BASE_DIR) / "sau_cli.py"
subprocess.run(
[
sys.executable,
str(cli_path),
"bilibili",
"login",
"--account",
"creator",
],
check=True,
)

View File

@@ -0,0 +1,10 @@
import asyncio
from pathlib import Path
from conf import BASE_DIR
from uploader.douyin_uploader.main import douyin_setup
if __name__ == '__main__':
account_file = Path(BASE_DIR / "cookies" / "douyin_uploader" / "account.json")
account_file.parent.mkdir(exist_ok=True)
cookie_setup = asyncio.run(douyin_setup(str(account_file), handle=True))

View File

@@ -0,0 +1,21 @@
"""Legacy direct login helper for Kuaishou.
Current mainline usage prefers:
sau kuaishou login --account creator
"""
import asyncio
from pathlib import Path
from conf import BASE_DIR
from uploader.ks_uploader.main import ks_setup
def login_to_kuaishou():
account_file = Path(BASE_DIR / "cookies" / "kuaishou_creator.json")
account_file.parent.mkdir(exist_ok=True)
asyncio.run(ks_setup(str(account_file), handle=True))
if __name__ == '__main__':
login_to_kuaishou()

View File

@@ -0,0 +1,11 @@
import asyncio
from pathlib import Path
from conf import BASE_DIR
from uploader.tencent_uploader.main import tencent_setup
if __name__ == "__main__":
account_file = Path(BASE_DIR / "cookies" / "tencent_uploader" / "account.json")
account_file.parent.mkdir(exist_ok=True)
asyncio.run(tencent_setup(str(account_file), handle=True))

View File

@@ -0,0 +1,10 @@
import asyncio
from pathlib import Path
from conf import BASE_DIR
from uploader.tk_uploader.main_chrome import tiktok_setup
if __name__ == '__main__':
account_file = Path(BASE_DIR / "cookies" / "tk_uploader" / "account.json")
account_file.parent.mkdir(exist_ok=True)
cookie_setup = asyncio.run(tiktok_setup(str(account_file), handle=True))

View File

@@ -0,0 +1,24 @@
"""
当前主线优先使用 CLI
sau xiaohongshu login --account <account_name>
这个脚本保留为小红书 uploader 的调试入口 / 历史直连路径。
"""
import asyncio
from pathlib import Path
from conf import BASE_DIR
from uploader.xiaohongshu_uploader.main import xiaohongshu_setup
if __name__ == '__main__':
account_file = Path(BASE_DIR / "cookies" / "xiaohongshu_uploader" / "account.json")
account_file.parent.mkdir(exist_ok=True)
result = asyncio.run(
xiaohongshu_setup(
str(account_file),
handle=True,
return_detail=True,
)
)

View File

@@ -0,0 +1,64 @@
"""Legacy direct-uploader example for Douyin.
Current mainline usage prefers:
sau douyin login --account creator
sau douyin upload-video ...
sau douyin upload-note ...
"""
import asyncio
from datetime import datetime
from pathlib import Path
from conf import BASE_DIR
from uploader.douyin_uploader.main import (
DOUYIN_PUBLISH_STRATEGY_IMMEDIATE,
DOUYIN_PUBLISH_STRATEGY_SCHEDULED,
DouYinNote,
DouYinVideo,
)
def upload_video_to_douyin():
account_file = Path(BASE_DIR / "cookies" / "douyin_uploader" / "account.json")
video_file_path = Path(BASE_DIR) / "videos/demo.mp4"
video_meta_title = "男子为了心爱之人每天坚守❤️‍🩹"
video_meta_hashtags = ["坚持不懈", "爱情执着", "奋斗使者", "短视频"]
thumbnail_landscape_path = Path(BASE_DIR) / "videos/demo.png"
thumbnail_portrait_path = Path(BASE_DIR) / "videos/demo.png"
video_meta_publish_time = datetime.strptime("2026-3-25 12:13", "%Y-%m-%d %H:%M")
app = DouYinVideo(
title=video_meta_title,
file_path=video_file_path,
tags=video_meta_hashtags,
publish_date=video_meta_publish_time,
thumbnail_landscape_path=thumbnail_landscape_path,
thumbnail_portrait_path=thumbnail_portrait_path,
account_file=account_file,
publish_strategy=DOUYIN_PUBLISH_STRATEGY_SCHEDULED,
)
asyncio.run(app.douyin_upload_video())
def upload_note_to_douyin():
account_file = Path(BASE_DIR / "cookies" / "douyin_uploader" / "account.json")
image_paths = [Path(BASE_DIR) / "videos/demo.png", Path(BASE_DIR) / "videos/demo.png", Path(BASE_DIR) / "videos/demo.png"]
note = "图文内容示例"
tags = ["图文", "示例", "抖音图文"]
video_meta_publish_time = datetime.strptime("2026-3-25 12:13", "%Y-%m-%d %H:%M")
app = DouYinNote(
image_paths=image_paths,
note=note,
tags=tags,
publish_date=0,
account_file=account_file,
publish_strategy=DOUYIN_PUBLISH_STRATEGY_IMMEDIATE,
)
asyncio.run(app.douyin_upload_note())
if __name__ == "__main__":
# upload_video_to_douyin()
upload_note_to_douyin()

View File

@@ -0,0 +1,72 @@
"""Legacy direct-uploader example for Kuaishou.
Current mainline usage prefers:
sau kuaishou login --account creator
sau kuaishou upload-video ...
sau kuaishou upload-note ...
"""
import asyncio
from datetime import datetime
from pathlib import Path
from conf import BASE_DIR
from uploader.ks_uploader.main import (
KUAISHOU_PUBLISH_STRATEGY_IMMEDIATE,
KUAISHOU_PUBLISH_STRATEGY_SCHEDULED,
KSNote,
KSVideo,
)
def upload_video_to_kuaishou():
account_file = Path(BASE_DIR / "cookies" / "kuaishou_creator.json")
account_file.parent.mkdir(exist_ok=True)
video_file_path = Path(BASE_DIR) / "videos/demo.mp4"
thumbnail_path = video_file_path.with_suffix(".png")
video_meta_title = "快手视频上传示例"
video_meta_hashtags = ["快手", "自动上传", "示例"]
video_meta_publish_time = datetime.strptime("2026-03-27 12:13", "%Y-%m-%d %H:%M")
publish_strategy = KUAISHOU_PUBLISH_STRATEGY_SCHEDULED
app = KSVideo(
title=video_meta_title,
file_path=video_file_path,
tags=video_meta_hashtags,
publish_date=video_meta_publish_time,
account_file=account_file,
thumbnail_path=thumbnail_path if thumbnail_path.exists() else None,
publish_strategy=publish_strategy,
)
asyncio.run(app.main())
def upload_note_to_kuaishou():
account_file = Path(BASE_DIR / "cookies" / "kuaishou_creator.json")
account_file.parent.mkdir(exist_ok=True)
image_paths = [
Path(BASE_DIR) / "videos/demo.png",
Path(BASE_DIR) / "videos/demo1.png",
Path(BASE_DIR) / "videos/demo2.png",
]
note = "快手图文内容示例"
tags = ["快手图文", "自动上传", "示例"]
note_meta_publish_time = datetime.strptime("2026-03-27 12:13", "%Y-%m-%d %H:%M")
publish_strategy = KUAISHOU_PUBLISH_STRATEGY_SCHEDULED
app = KSNote(
image_paths=image_paths,
note=note,
tags=tags,
publish_date=note_meta_publish_time,
account_file=account_file,
publish_strategy=publish_strategy,
)
asyncio.run(app.main())
if __name__ == '__main__':
upload_video_to_kuaishou()
# upload_note_to_kuaishou()

View File

@@ -0,0 +1,27 @@
import asyncio
from pathlib import Path
from conf import BASE_DIR
from uploader.baijiahao_uploader.main import baijiahao_setup, BaiJiaHaoVideo
from utils.files_times import generate_schedule_time_next_day, get_title_and_hashtags
if __name__ == '__main__':
filepath = Path(BASE_DIR) / "videos"
account_file = Path(BASE_DIR / "cookies" / "baijiahao_uploader" / "account.json")
# 获取视频目录
folder_path = Path(filepath)
# 获取文件夹中的所有文件
files = list(folder_path.glob("*.mp4"))
file_num = len(files)
publish_datetimes = generate_schedule_time_next_day(file_num, 1, daily_times=[16])
cookie_setup = asyncio.run(baijiahao_setup(account_file, handle=False))
for index, file in enumerate(files):
title, tags = get_title_and_hashtags(str(file))
thumbnail_path = file.with_suffix('.png')
# 打印视频文件名、标题和 hashtag
print(f"视频文件名:{file}")
print(f"标题:{title}")
print(f"Hashtag{tags}")
app = BaiJiaHaoVideo(title, file, tags, publish_datetimes[index], account_file)
asyncio.run(app.main(), debug=False)

View File

@@ -0,0 +1,44 @@
import subprocess
import sys
from pathlib import Path
from conf import BASE_DIR
from utils.constant import VideoZoneTypes
from utils.files_times import generate_schedule_time_next_day, get_title_and_hashtags
if __name__ == '__main__':
filepath = Path(BASE_DIR) / "videos"
folder_path = Path(filepath)
files = list(folder_path.glob("*.mp4"))
file_num = len(files)
publish_datetimes = generate_schedule_time_next_day(file_num, 1, daily_times=[16])
cli_path = Path(BASE_DIR) / "sau_cli.py"
for index, file in enumerate(files):
title, tags = get_title_and_hashtags(str(file))
print(f"视频文件名:{file}")
print(f"标题:{title}")
print(f"Hashtag{tags}")
desc = title
schedule_text = publish_datetimes[index].strftime("%Y-%m-%d %H:%M")
command = [
sys.executable,
str(cli_path),
"bilibili",
"upload-video",
"--account",
"creator",
"--file",
str(file),
"--title",
title,
"--desc",
desc,
"--tid",
str(VideoZoneTypes.SPORTS_FOOTBALL.value),
"--tags",
",".join(tags),
"--schedule",
schedule_text,
]
subprocess.run(command, check=True)

View File

@@ -0,0 +1,109 @@
"""
当前文件先保留为视频号 uploader 的调试入口 / 历史直连路径。
注意:
1. `uploader/tencent_uploader/main.py` 里的核心页面交互逻辑目前是骨架;
2. 你需要自己补视频里的 `fill_title_and_tags` / `wait_for_upload_complete` / `set_thumbnail` / `submit_publish` 等方法;
3. 你需要自己补图文里的 `switch_to_note_mode` / `upload_note_images` / `fill_note_title_and_tags` / `submit_publish` 等方法;
3. 补完后,这个 example 就可以直接作为本地调试入口继续使用。
"""
import asyncio
from datetime import datetime, timedelta
from pathlib import Path
from conf import BASE_DIR
from uploader.tencent_uploader.main import TENCENT_PUBLISH_STRATEGY_IMMEDIATE
from uploader.tencent_uploader.main import TENCENT_PUBLISH_STRATEGY_SCHEDULED
from uploader.tencent_uploader.main import TencentNote
from uploader.tencent_uploader.main import TencentVideo
ACCOUNT_FILE = Path(BASE_DIR / "cookies" / "tencent_uploader" / "account.json")
def upload_video_to_tencent():
video_file = Path(BASE_DIR) / "videos" / "demo.mp4"
thumbnail_path = video_file.with_suffix(".png")
app = TencentVideo(
title="视频号视频示例",
file_path=str(video_file),
tags=["视频号", "自动上传", "调试入口"],
publish_strategy=TENCENT_PUBLISH_STRATEGY_IMMEDIATE,
publish_date=0,
account_file=str(ACCOUNT_FILE),
desc="这里是你后面准备填写的视频简介示例",
thumbnail_path=str(thumbnail_path) if thumbnail_path.exists() else None,
short_title="视频号示例",
category=None,
is_draft=False,
)
asyncio.run(app.tencent_upload_video())
def upload_video_to_tencent_scheduled():
video_file = Path(BASE_DIR) / "videos" / "demo.mp4"
thumbnail_path = video_file.with_suffix(".png")
publish_time = (datetime.now() + timedelta(hours=3)).replace(second=0, microsecond=0)
app = TencentVideo(
title="视频号定时发布示例",
file_path=str(video_file),
tags=["视频号", "定时发布", "调试入口"],
publish_strategy=TENCENT_PUBLISH_STRATEGY_SCHEDULED,
publish_date=publish_time,
account_file=str(ACCOUNT_FILE),
desc="这里是定时发布的视频简介示例",
thumbnail_path=str(thumbnail_path) if thumbnail_path.exists() else None,
short_title="定时发布示例",
category=None,
is_draft=False,
)
asyncio.run(app.tencent_upload_video())
def upload_note_to_tencent():
image_candidates = [
Path(BASE_DIR) / "videos" / "demo.png",
Path(BASE_DIR) / "videos" / "demo1.png",
Path(BASE_DIR) / "videos" / "demo2.png",
]
image_paths = [str(path) for path in image_candidates if path.exists()]
app = TencentNote(
image_paths=image_paths,
note="视频号图文内容示例 #图文调试",
tags=["视频号图文", "自动上传", "调试入口"],
publish_strategy=TENCENT_PUBLISH_STRATEGY_IMMEDIATE,
publish_date=0,
account_file=str(ACCOUNT_FILE),
title="视频号图文示例",
is_draft=False,
)
asyncio.run(app.tencent_upload_note())
def upload_note_to_tencent_scheduled():
image_candidates = [
Path(BASE_DIR) / "videos" / "demo.png",
Path(BASE_DIR) / "videos" / "demo1.png",
Path(BASE_DIR) / "videos" / "demo2.png",
]
image_paths = [str(path) for path in image_candidates if path.exists()]
publish_time = (datetime.now() + timedelta(hours=3)).replace(second=0, microsecond=0)
app = TencentNote(
image_paths=image_paths,
note="视频号图文定时发布示例 #图文调试",
tags=["视频号图文", "定时发布", "调试入口"],
publish_strategy=TENCENT_PUBLISH_STRATEGY_SCHEDULED,
publish_date=publish_time,
account_file=str(ACCOUNT_FILE),
title="视频号图文定时示例",
is_draft=False,
)
asyncio.run(app.tencent_upload_note())
if __name__ == "__main__":
upload_video_to_tencent()
# upload_video_to_tencent_scheduled()
# upload_note_to_tencent()
# upload_note_to_tencent_scheduled()

View File

@@ -0,0 +1,30 @@
import asyncio
from pathlib import Path
from conf import BASE_DIR
# from tk_uploader.main import tiktok_setup, TiktokVideo
from uploader.tk_uploader.main_chrome import tiktok_setup, TiktokVideo
from utils.files_times import generate_schedule_time_next_day, get_title_and_hashtags
if __name__ == '__main__':
filepath = Path(BASE_DIR) / "videos"
account_file = Path(BASE_DIR / "cookies" / "tk_uploader" / "account.json")
folder_path = Path(filepath)
# get video files from folder
files = list(folder_path.glob("*.mp4"))
file_num = len(files)
publish_datetimes = generate_schedule_time_next_day(file_num, 1, daily_times=[16])
cookie_setup = asyncio.run(tiktok_setup(account_file, handle=True))
for index, file in enumerate(files):
title, tags = get_title_and_hashtags(str(file))
thumbnail_path = file.with_suffix('.png')
print(f"video_file_name{file}")
print(f"video_title{title}")
print(f"video_hashtag{tags}")
if thumbnail_path.exists():
print(f"thumbnail_file_name{thumbnail_path}")
app = TiktokVideo(title, file, tags, publish_datetimes[index], account_file, thumbnail_path)
else:
app = TiktokVideo(title, file, tags, publish_datetimes[index], account_file)
asyncio.run(app.main(), debug=False)

View File

@@ -0,0 +1,68 @@
import configparser
from pathlib import Path
from time import sleep
from xhs import XhsClient
from conf import BASE_DIR
from utils.files_times import generate_schedule_time_next_day, get_title_and_hashtags
from uploader.xhs_uploader.main import sign_local, beauty_print
config = configparser.RawConfigParser()
config.read(Path(BASE_DIR / "uploader" / "xhs_uploader" / "accounts.ini"))
if __name__ == '__main__':
filepath = Path(BASE_DIR) / "videos"
# 获取视频目录
folder_path = Path(filepath)
# 获取文件夹中的所有文件
files = list(folder_path.glob("*.mp4"))
file_num = len(files)
cookies = config['account1']['cookies']
xhs_client = XhsClient(cookies, sign=sign_local, timeout=60)
# auth cookie
# 注意该校验cookie方式可能并没那么准确
try:
xhs_client.get_video_first_frame_image_id("3214")
except:
print("cookie 失效")
exit()
publish_datetimes = generate_schedule_time_next_day(file_num, 1, daily_times=[16])
for index, file in enumerate(files):
title, tags = get_title_and_hashtags(str(file))
# 加入到标题 补充标题xhs 可以填1000字不写白不写
tags_str = ' '.join(['#' + tag for tag in tags])
hash_tags_str = ''
hash_tags = []
# 打印视频文件名、标题和 hashtag
print(f"视频文件名:{file}")
print(f"标题:{title}")
print(f"Hashtag{tags}")
topics = []
# 获取hashtag
for i in tags[:3]:
topic_official = xhs_client.get_suggest_topic(i)
if topic_official:
topic_official[0]['type'] = 'topic'
topic_one = topic_official[0]
hash_tag_name = topic_one['name']
hash_tags.append(hash_tag_name)
topics.append(topic_one)
hash_tags_str = ' ' + ' '.join(['#' + tag + '[话题]#' for tag in hash_tags])
note = xhs_client.create_video_note(title=title[:20], video_path=str(file),
desc=title + tags_str + hash_tags_str,
topics=topics,
is_private=False,
post_time=publish_datetimes[index].strftime("%Y-%m-%d %H:%M:%S"))
beauty_print(note)
# 强制休眠30s避免风控必要
sleep(30)

View File

@@ -0,0 +1,100 @@
"""
当前主线优先使用 CLI
sau xiaohongshu login --account <account_name>
sau xiaohongshu upload-video --account <account_name> --file videos/demo.mp4 --title "示例标题" --desc "示例简介"
sau xiaohongshu upload-note --account <account_name> --images videos/1.png videos/2.png --title "图文标题" --note "图文正文"
这个脚本保留为小红书 uploader 的调试入口 / 历史直连路径。
"""
import asyncio
from datetime import datetime, timedelta
from pathlib import Path
from conf import BASE_DIR
from uploader.xiaohongshu_uploader.main import XIAOHONGSHU_PUBLISH_STRATEGY_IMMEDIATE
from uploader.xiaohongshu_uploader.main import XIAOHONGSHU_PUBLISH_STRATEGY_SCHEDULED
from uploader.xiaohongshu_uploader.main import XiaoHongShuNote
from uploader.xiaohongshu_uploader.main import XiaoHongShuVideo
ACCOUNT_FILE = Path(BASE_DIR / "cookies" / "xiaohongshu_uploader" / "account.json")
def upload_video_to_xiaohongshu():
video_file = Path(BASE_DIR) / "videos" / "demo.mp4"
thumbnail_path = video_file.with_suffix(".png")
app = XiaoHongShuVideo(
title="小红书视频示例",
file_path=str(video_file),
desc="你好",
tags=["小红书", "视频示例", "调试入口"],
publish_strategy=XIAOHONGSHU_PUBLISH_STRATEGY_IMMEDIATE,
publish_date=0,
account_file=str(ACCOUNT_FILE),
thumbnail_path=str(thumbnail_path) if thumbnail_path.exists() else None,
)
asyncio.run(app.xiaohongshu_upload_video())
def upload_video_to_xiaohongshu_scheduled():
video_file = Path(BASE_DIR) / "videos" / "demo.mp4"
thumbnail_path = video_file.with_suffix(".png")
publish_time = (datetime.now() + timedelta(hours=3)).replace(second=0, microsecond=0)
app = XiaoHongShuVideo(
title="小红书视频定时发布示例",
file_path=str(video_file),
desc="这是一条定时发布的小红书视频示例",
tags=["小红书", "定时发布", "调试入口"],
publish_strategy=XIAOHONGSHU_PUBLISH_STRATEGY_SCHEDULED,
publish_date=publish_time,
account_file=str(ACCOUNT_FILE),
thumbnail_path=str(thumbnail_path) if thumbnail_path.exists() else None,
)
asyncio.run(app.xiaohongshu_upload_video())
def upload_note_to_xiaohongshu():
image_candidates = [
Path(BASE_DIR) / "videos" / "demo.png",
Path(BASE_DIR) / "videos" / "demo1.png",
Path(BASE_DIR) / "videos" / "demo2.png",
]
image_paths = [str(path) for path in image_candidates if path.exists()]
app = XiaoHongShuNote(
image_paths=image_paths,
note="小红书图文内容示例 #图文调试",
tags=["小红书图文", "自动上传", "调试入口"],
publish_strategy=XIAOHONGSHU_PUBLISH_STRATEGY_IMMEDIATE,
publish_date=0,
account_file=str(ACCOUNT_FILE),
title="小红书图文示例",
)
asyncio.run(app.xiaohongshu_upload_note())
def upload_note_to_xiaohongshu_scheduled():
image_candidates = [
Path(BASE_DIR) / "videos" / "demo.png",
Path(BASE_DIR) / "videos" / "demo1.png",
Path(BASE_DIR) / "videos" / "demo2.png",
]
image_paths = [str(path) for path in image_candidates if path.exists()]
publish_time = (datetime.now() + timedelta(hours=3)).replace(second=0, microsecond=0)
app = XiaoHongShuNote(
image_paths=image_paths,
note="小红书图文内容示例 #图文调试",
tags=["小红书图文", "自动上传", "调试入口"],
publish_strategy=XIAOHONGSHU_PUBLISH_STRATEGY_SCHEDULED,
publish_date=publish_time,
account_file=str(ACCOUNT_FILE),
title="小红书图文示例",
)
asyncio.run(app.xiaohongshu_upload_note())
if __name__ == '__main__':
# upload_video_to_xiaohongshu()
# upload_video_to_xiaohongshu_scheduled()
# upload_note_to_xiaohongshu()
upload_note_to_xiaohongshu_scheduled()