mirror of
https://github.com/dreammis/social-auto-upload.git
synced 2026-09-21 04:46:27 +08:00
fix: 增加 postVideo 脚本
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
import asyncio
|
||||
from pathlib import Path
|
||||
|
||||
from sau_backend.conf import BASE_DIR
|
||||
from sau_backend.uploader.douyin_uploader.main import DouYinVideo
|
||||
from sau_backend.uploader.ks_uploader.main import KSVideo
|
||||
from sau_backend.uploader.tencent_uploader.main import TencentVideo
|
||||
from sau_backend.utils.constant import TencentZoneTypes
|
||||
from sau_backend.utils.files_times import generate_schedule_time_next_day
|
||||
|
||||
|
||||
def post_video_tencent(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]
|
||||
if enableTimer:
|
||||
publish_datetimes = generate_schedule_time_next_day(len(files), videos_per_day, daily_times,start_days)
|
||||
else:
|
||||
publish_datetimes = [0 for i in range(len(files))]
|
||||
for index, file in enumerate(files):
|
||||
for cookie in account_file:
|
||||
print(f"文件路径{str(file)}")
|
||||
# 打印视频文件名、标题和 hashtag
|
||||
print(f"视频文件名:{file}")
|
||||
print(f"标题:{title}")
|
||||
print(f"Hashtag:{tags}")
|
||||
app = TencentVideo(title, str(file), tags, publish_datetimes[index], cookie, category)
|
||||
asyncio.run(app.main(), debug=False)
|
||||
|
||||
|
||||
def post_video_DouYin(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]
|
||||
if enableTimer:
|
||||
publish_datetimes = generate_schedule_time_next_day(len(files), videos_per_day, daily_times,start_days)
|
||||
else:
|
||||
publish_datetimes = [0 for i in range(len(files))]
|
||||
for index, file in enumerate(files):
|
||||
for cookie in account_file:
|
||||
print(f"文件路径{str(file)}")
|
||||
# 打印视频文件名、标题和 hashtag
|
||||
print(f"视频文件名:{file}")
|
||||
print(f"标题:{title}")
|
||||
print(f"Hashtag:{tags}")
|
||||
app = DouYinVideo(title, str(file), tags, publish_datetimes[index], cookie, category)
|
||||
asyncio.run(app.main(), debug=False)
|
||||
|
||||
|
||||
def post_video_ks(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]
|
||||
if enableTimer:
|
||||
publish_datetimes = generate_schedule_time_next_day(len(files), videos_per_day, daily_times,start_days)
|
||||
else:
|
||||
publish_datetimes = [0 for i in range(len(files))]
|
||||
for index, file in enumerate(files):
|
||||
for cookie in account_file:
|
||||
print(f"文件路径{str(file)}")
|
||||
# 打印视频文件名、标题和 hashtag
|
||||
print(f"视频文件名:{file}")
|
||||
print(f"标题:{title}")
|
||||
print(f"Hashtag:{tags}")
|
||||
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:
|
||||
|
||||
|
||||
|
||||
# post_video("333",["demo.mp4"],"d","d")
|
||||
# post_video_DouYin("333",["demo.mp4"],"d","d")
|
||||
Reference in New Issue
Block a user