3

I'm trying to upload a video to facebook from an external url. But I got error when I post it. I tried with local videos, and all works fine.

My simple code is :

answer = graph.post(
        path="597739293577402/videos",
        source='https://d3ldtt2c6t0t08.cloudfront.net/files/rhn4phpt3rh4u/2015/06/17/Z7EO2GVADLFBG6WVMKSD5IBOFI/main_OUTPUT.tmp.mp4',
    )

and my error is allways the same :

FacebookError: [6000] There was a problem uploading your video file. Please try again with another file.

I looked into the docs and found the parameter file_url but it still the same issue.

The format of the video is .mp4 so it should work.

Any idea ?

Apparently this error message is very confusing. It's the same message when you've an access_token who doesn't work. For example, I've this error message when I'm trying with my user access token and not if I use the Page access token.

DaschPyth
  • 195
  • 1
  • 2
  • 9
  • Have you got the correct permissions for the page you are trying to upload too? You should be using a Page Access Token with the 'publish_pages' permission as documented [here](https://developers.facebook.com/docs/graph-api/reference/page/videos#Creating) – The1Fitz Jun 22 '15 at 11:40
  • Yes I've ! I've check all the permissions. Right now I'm facing this issue with an local file which he said that I've no permission. But when I go to the graph tool, I put the correct permissions so I don't understand why it doesn't work. If I want to publish on a page, I need only my access_token with the permission on the page right ? – DaschPyth Jun 23 '15 at 13:08
  • @DaschPyth all you need is your access_token to post to a page. Have you ever been able to successfully post a video? Have you checked your permissions on your app? – AdjunctProfessorFalcon Jul 26 '15 at 20:32

1 Answers1

2

I've never used source, I'm pretty sure that's for reading video data off their API. Instead, I use file_url in my payload when passing video file URLs to Facebook Graph API.

Refer to their API doc for clarity on that...

It's also possible that the tmp.mp4 file extension is causing you problems. I've had issues with valid video URLs with non-typical file extensions similar to that. Is it possible to alter that at the source so that the URL doesn't have the tmp ?

A typical payload pass using Requests module to their API that works for me might look something like this:

fburl = 'https://graph-video.facebook.com/v2.3/156588/videos?access_token='+str(access)
payload = {'name': '%s' %(videoName), 'description': '%s' %(videoDescription), 'file_url': '%s' %(videoUrl)}
flag = requests.post(fburl, data=payload).text
print flag
fb_res = json.loads(flag)

I would also highly recommend that you obtain a permanent page access token. It's the best way to mitigate the complexities of Facebook's oAuth process.

facebook: permanent Page Access Token?

Community
  • 1
  • 1
AdjunctProfessorFalcon
  • 1,790
  • 6
  • 26
  • 62
  • I'll put your answer as a good one. I managed to do it after the good access-token. You talk about a permanent page access token but I couldn't make it work after generating it. It's maybe my fault because Facebook oauth token is such a mess ! Thx by the way :) – DaschPyth Jul 28 '15 at 09:37
  • @DaschPyth it's a multi-step process to procure the permanent page access, took me a few tries, but it does work if you use cURL instead of trying to do it using just Requests. – AdjunctProfessorFalcon Jul 28 '15 at 17:44