I have a working access_token with every available permission in the Graph explorer page granted.
I am able to aparently upload a video chunk by chunk without problems. Once I finish uploading it I do indeed get a file handle along the lines of {'h': '4::: ....'}. However I am getting an error when trying to actually publish it. The publish request returns the aforementioned error #100, but I don't know what other permission should I need. My acoount is a business account, does it need to be business verified?
The docs are not very clear either as in the video-api/guides/publishing page, guide says to use the graph-video.facebook.com url but it seems deprecated? Anything I am missing? Thanks.
```` params = { 'file_name': file_name, 'file_length': file_length, 'file_type': file_type, 'access_token': access_token }
session = requests.post(session_url, params=params) if session.status_code != 200: print(f"Failed to initiate upload session: {session.text}")
upload_id = session.json()['id'] file_offset = 0 chunk_size=1048576
with open(video_path, 'rb') as file: file.seek(file_offset) # data = file.read(chunk_size)
headers = { 'Authorization': f'OAuth {access_token}', 'file_offset': str(file_offset) }
first_chunk = requests.post(session_url, headers=headers, data=data) file_handle = first_chunk.json()['id']
with open(video_path, 'rb') as file:
while file_offset < file_length:
print(file_offset)
file.seek(file_offset)
data = file.read(chunk_size)
headers = {
'Authorization': f'OAuth {cces_access_token}',
'file_offset': str(file_offset)
}
resume_url = f"https://graph.facebook.com/v20.0/{file_handle}"
response = requests.post(resume_url, headers=headers, data=data)
if response.status_code != 200:
print(f"Failed to upload chunk at offset {file_offset}: {response.text}")
file_offset += len(data)
uploaded_file_handle = response.json()['h']
url = f"https://graph.facebook.com/v20.0/{page_id}/videos"
data = { 'access_token': access_token, 'upload_phase': 'finish', 'title': 'test_title', 'description': 'test_desc', 'privacy': '{"value":"SELF"}', }
files = { 'fbuploader_video_file_chunk': (None, uploaded_file_handle) }
publish = requests.post(url, files=files,data=data) ''''