You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Iterate over upload instructions and upload video chunks
for upload_instruction in upload_instructions["value"]["uploadInstructions"]:
upload_url = upload_instruction["uploadUrl"]
first_byte = upload_instruction["firstByte"]
last_byte = upload_instruction["lastByte"]
# Open the video file and seek to the specified byte range
with urllib.request.urlopen(video_url) as file:
file_chunk = file.read(last_byte - first_byte + 1)
# Upload the video chunk to the specified URL
upload_video_chunk_data(upload_url, file_chunk)
Below is mu code when i run it i am not gettinging "Etage" like this:
HTTP/1.1 200 OK
Content-Length: 0
Connection: keep-alive
x-amz-id-2: 2wer1EizXFXQneT6n1VAa4l1ggPOM9cOl0jJFgpk0ocOYyZsjLKAHaQwmOKi47hHG6D9R2w4y5A=
x-amz-request-id: C6DA7DF813E33C69
Date: Thu, 27 Sep 2018 22:40:01 GMT
x-amz-version-id: AguPSmqVmxmrKvuJ56mIDeUu5FqnJffZ
x-amz-server-side-encryption: aws:kms
x-amz-server-side-encryption-aws-kms-key-id: arn:aws:kms:us-east-1:123456789:key/e10ace24-blah-4977-bar-89foo193e2ab
ETag: "e4383924336106965d6cd2a111beaceb"
Server: AmazonS3
X-Amz-Cf-Id: CgvELDhzYQgJ8qpJka_pAscHJ4Dnwsc0sDj4zZAiwnji-YZXK2aRdA==
Here is Documentation of API:
https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/vector-asset-api?view=li-lms-2023-06&tabs=http#registering-multi-part-upload
`
import requests
import json
import urllib.request
video_url = input_data["file_path"] #VIDEO URL
upload_instructions = json.loads(input_data["upload_instructions"]) #GET Upload URL and other rquire thing
def upload_video_chunk_data(url, file_chunk):
headers = {"Content-Type": "application/octet-stream"}
response = requests.post(url, headers=headers, data=file_chunk)
print(response)
global file_chunk
global upload_url
Iterate over upload instructions and upload video chunks
for upload_instruction in upload_instructions["value"]["uploadInstructions"]:
upload_url = upload_instruction["uploadUrl"]
first_byte = upload_instruction["firstByte"]
last_byte = upload_instruction["lastByte"]
Send a POST request to finalize the video upload
videoID = upload_instructions['value']['video']
return {"video_id":videoID}`
The text was updated successfully, but these errors were encountered: