Posting an embedded video link using the Facebook Graph API

后端 未结 7 1902
独厮守ぢ
独厮守ぢ 2020-12-02 06:29

When manually attaching a video link (from YouTube, Vimeo, etc) to a post using the Facebook web interface, Facebook automatically recognizes the link as a video, and allows

7条回答
  •  醉梦人生
    2020-12-02 07:15

    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
    

    It appears that you can generate a valid source and picture from the page URL. The URL looks like http://www.youtube.com/watch?v=; take the code (3aICB2mUu2k here) and insert it into the URLs http://www.youtube.com/e/ for the source and and http://img.youtube.com/vi//0.jpg for the picture.

提交回复
热议问题