feat: 增加 xiaohongshu 的登录和发布相关脚本

This commit is contained in:
Edan's Win11
2025-06-03 23:02:47 +08:00
parent 8be9a09432
commit 86fb7f6563
12 changed files with 535 additions and 22 deletions
+18 -2
View File
@@ -5,6 +5,7 @@ from conf import BASE_DIR
from uploader.douyin_uploader.main import DouYinVideo
from uploader.ks_uploader.main import KSVideo
from uploader.tencent_uploader.main import TencentVideo
from uploader.xiaohongshu_uploader.main import XiaoHongShuVideo
from utils.constant import TencentZoneTypes
from utils.files_times import generate_schedule_time_next_day
@@ -65,8 +66,23 @@ def post_video_ks(title,files,tags,account_file,category=TencentZoneTypes.LIFEST
app = KSVideo(title, str(file), tags, publish_datetimes[index], cookie)
asyncio.run(app.main(), debug=False)
# def post_every_type(list):
# for task_dist in list:
def post_video_xhs(title,files,tags,account_file,category=TencentZoneTypes.LIFESTYLE.value,enableTimer=False,videos_per_day = 1, daily_times=None,start_days = 0):
# 生成文件的完整路径
account_file = [Path(BASE_DIR / "cookiesFile" / file) for file in account_file]
files = [Path(BASE_DIR / "videoFile" / file) for file in files]
file_num = len(files)
if enableTimer:
publish_datetimes = generate_schedule_time_next_day(file_num, videos_per_day, daily_times,start_days)
else:
publish_datetimes = 0
for index, file in enumerate(files):
for cookie in account_file:
# 打印视频文件名、标题和 hashtag
print(f"视频文件名:{file}")
print(f"标题:{title}")
print(f"Hashtag:{tags}")
app = XiaoHongShuVideo(title, file, tags, publish_datetimes, cookie)
asyncio.run(app.main(), debug=False)