-
Notifications
You must be signed in to change notification settings - Fork 952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New feature: post video #265
Comments
Sorry I didn't reply earlier to this. This would be a fine feature to add, although you might want to look at previous pull requests to add video posting support in order to avoid their problems. |
is there any documents for upload videos. |
You can try the following, I am planning to testify it and submit a function
|
Hi dragonfly90 My python requests module: My video format is in mp4 there is error 408 Request Timeout at the line "r = requests.post(fb_url, headers={'Content-Type': m.content_type}, data=m)" multipart chunked uploads
when not using multipart chunked uploads, it works perfectly "local_video_file = {'file': open(local_video_file, 'rb')}" is there any requirement to make it work with multipart chunked uploads thank you |
Is this feature now enabled and merged with master? |
My file is mp4 but I get
|
try this:
read https://developers.facebook.com/docs/graph-api/video-uploads/#nonresumable to know about limitations |
When i use the solution @dragonfly90 suggested i get an error:
Video is mp4 and its just 2mb. |
@alicmp keep the title same as the name of the video file |
Does anyone know how to embed a video that been uploaded, on a post? I've managed to upload the video without a story/post being created, but now wanna make a custom post with a message and the video embedded: r = requests.post(url, files={"file": open("C:/Users/admin/Desktop/test.gif", "rb")}, data={"no_story": "true"}) |
Ended up using the requests.post(url, files={"file": open("C:/Users/admin/Desktop/test.gif", "rb")}, data={"description": "true"}) |
|
thank you it is working |
this is what worked for me import requests
# Replace these with your Facebook access token and video file path
access_token = 'YOUR-TOKEN'
video_path = 'video.mp4' # Path to your video file
# Step 1: Upload video
endpoint = f'https://graph-video.facebook.com/v19.0/me/videos?access_token={access_token}'
files = {'file': open(video_path, 'rb')}
response = requests.post(endpoint, files=files)
video_data = response.json()
if 'id' in video_data:
video_id = video_data['id']
print("Video uploaded successfully with ID:", video_id)
# Step 2: Share the video on your Facebook timeline
graph_endpoint = f'https://graph.facebook.com/v19.0/me/feed'
params = {
'access_token': access_token,
'message': 'Check out this fancy video!',
'link': f'https://www.facebook.com/watch/?v={video_id}'
}
response = requests.post(graph_endpoint, params=params)
if response.status_code == 200:
print("Video shared on your Facebook timeline successfully!")
else:
print("Failed to share the video on your Facebook timeline.")
else:
print("Failed to upload the video.") |
Currently, posting video is not supported by python sdk, but actually you can do it by python. Is it a good idea to add the function in sdks?
The text was updated successfully, but these errors were encountered: