如何"创建带有视频的帖子"使用Facebook API?

时间:2017-04-22 22:07:48

标签: facebook-graph-api video

我尝试在我的粉丝页面中创建一个新帖子,其中包含已上传和发布的视频。进入页面菜单 - > "发布工具" - > "视频库"可以点击已发布的视频并发布新帖子,但我不知道如何使用Facebook API创建这个新的帖子+视频。

1 个答案:

答案 0 :(得分:0)

解决!

url = "https://graph.facebook.com/v2.9/me/videos"
title = "some title"               #post title
description = "some description"   #post description
crossposted_video_id = "12344444"  #get the video ID and grab it here!
content_category = "LIFESTYLE"     #there are some more categories to use in fb
scheduled_publish_time = ""        #in unix format
published = "false"                #if you want to schedule, set "false"
token = "page access token"        #you can get one in Graph API Explorer

param = {
    "crossposted_video_id": crossposted_video_id,
    "title": title,
    "description": description,
    "content_category": content_category,
    "scheduled_publish_time": scheduled_publish_time,
    "published": published,
    "access_token": token 
}
r = requests.post(url, json=param)