How to post an YouTube Video link through Facebook Graph API
Specifically what I'm looking for is the embedded video player functionality you would receive if you had just 开发者_如何学Gomanually shared a YouTube video but done programmatically through the Graph API.
It appears that you have to extract the URLs of the actual swf in the page and the thumbnail image yourself.
For example, this seems to work:
curl -F 'access_token=...' \
-F 'message=Link to YouTube' \
-F 'link=http://www.youtube.com/watch?v=3aICB2mUu2k' \
-F 'source=http://www.youtube.com/v/3aICB2mUu2k' \
-F 'picture=http://img.youtube.com/vi/3aICB2mUu2k/0.jpg' \
https://graph.facebook.com/me/feed
See source: Posting an embedded video link using the Facebook Graph API
You can either use the old REST API or the new Graph API. In either case you must have the publish_stream permission.
If you want to use the Graph API you need to create a Post object and then post it to the graph feed url for that profile
graph.facebook.com/PROFILE_ID/feed
You will want to set the source property in the Post object to the youTube url for the video.
http://developers.facebook.com/docs/reference/api/post/
If you want to use the older REST API the process is similar but you post to
api-video.facebook.com/restserver.php
Facebook does not allow youtube to play video on facebook anymore but direct them to youtube website to watch.
精彩评论