简体   繁体   中英

Facebook GraphAPI, Posting Video with Title/Description

I have no problem uploading videos currently but I'm not really sure how to add data to the upload. A plain video isn't good enough as I would like to add a description of the video and a title.

This is the code I have currently

def post_video():
 auth_token = "CENSORED"
 url = "https://graph-video.facebook.com/PAGE-ID/videos?access_token=" + auth
 video_path = 'completed/song.mp4'
 files = {'file': open(video_path, 'rb')}
 requests.post(url, files=files)

I have tried this

def post_video():
 auth_token = "CENSORED"
 url = "https://graph-video.facebook.com/PAGE-ID/videos?access_token=" + auth
 video_path = 'completed/song.mp4'
 files = {
          'file': open(video_path, 'rb'), 
          'title': 'SONG TITLE HERE'
         }
 requests.post(url, files=files)

But it hasn't worked. I even tried converting some PHP code to Python code but I really can't get it to work. Any help is appreciated!

I have no problem uploading videos currently but I'm not really sure how to add data to the upload. A plain video isn't good enough as I would like to add a description of the video and a title.

This is the code I have currently

def post_video():
 auth_token = "CENSORED"
 url = "https://graph-video.facebook.com/PAGE-ID/videos?access_token=" + auth
 video_path = 'completed/song.mp4'
 files = {'file': open(video_path, 'rb')}
 requests.post(url, files=files)

I have tried this

def post_video():
 auth_token = "CENSORED"
 url = "https://graph-video.facebook.com/PAGE-ID/videos?access_token=" + auth
 video_path = 'completed/song.mp4'
 files = {
          'file': open(video_path, 'rb'), 
          'title': 'SONG TITLE HERE'
         }
 requests.post(url, files=files)

But it hasn't worked. I even tried converting some PHP code to Python code but I really can't get it to work. Any help is appreciated!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM