增加本地推上传

This commit is contained in:
18610128193
2026-06-26 17:14:55 +08:00
parent cf1ca2be12
commit 4f2be8a137
4 changed files with 107 additions and 9 deletions
@@ -334,8 +334,14 @@ async def _upload_to_juliang(
file_content = f.read()
image_signature = hashlib.md5(file_content).hexdigest()
# data = {
# "advertiser_id": advertiser_id,
# "upload_type": "UPLOAD_BY_FILE",
# "image_signature": image_signature,
# "filename": filename,
# }
data = {
"advertiser_id": advertiser_id,
"local_account_id": advertiser_id,
"upload_type": "UPLOAD_BY_FILE",
"image_signature": image_signature,
"filename": filename,
@@ -345,7 +351,9 @@ async def _upload_to_juliang(
"image_file": (filename, file_content, "image/png"),
}
response = await douyin_api.upload_image_material(oauth_id, data, files)
# 上传本地推图片
response = await douyin_api.upload_local_image_material(oauth_id, data, files)
#response = await douyin_api.upload_image_material(oauth_id, data, files)
if response["code"] != 0:
return {
@@ -416,8 +424,14 @@ async def _upload_to_juliang(
file_content = f.read()
video_signature = hashlib.md5(file_content).hexdigest()
# data = {
# "advertiser_id": advertiser_id,
# "upload_type": "UPLOAD_BY_FILE",
# "video_signature": video_signature,
# "filename": filename,
# }
data = {
"advertiser_id": advertiser_id,
"local_account_id": advertiser_id,
"upload_type": "UPLOAD_BY_FILE",
"video_signature": video_signature,
"filename": filename,
@@ -428,6 +442,7 @@ async def _upload_to_juliang(
}
response = await douyin_api.upload_video_material(oauth_id, data, files)
#response = await douyin_api.upload_local_video_material(oauth_id, data, files)
if response["code"] != 0:
return {