使用Facebook Graph API发布嵌入式视频链接 [英] Posting an embedded video link using the Facebook Graph API

查看:132
本文介绍了使用Facebook Graph API发布嵌入式视频链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用Facebook网页界面手动将视频链接(从YouTube,Vimeo等)手动附加到帖子时,Facebook会自动将该链接识别为视频,并允许生成的状态消息内嵌播放视频。视频在墙壁或新闻Feed中显示为嵌入式播放器。






这是嵌入式视频看起来的一个例子喜欢手动发布。








当使用Graph API发布链接时,该视频未被嵌入。

  curl -F'access_token = ...'\ 
-F'message =链接到YouTube' \\
-F'link = http://www.youtube.com/watch?v = 3aICB2mUu2k'\
https://graph.facebook.com/me/feed






我怀疑答案与来源相关参数,但我不知道该URL应该在那里。指定相同的URL只是导致没有缩略图的帖子。


:要嵌入到帖子中的Flash电影或视频文件
的URL。
read_stream。


单独使用Graph API可以实现相同的嵌入式行为吗?

解决方案

您似乎必须自己提取页面中实际swf的URL和缩略图。例如,这似乎有效:

  curl -F'access_token = ...'\ 
-F 'message =链接到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://图。 facebook.com/me/feed

似乎您可以从页面生成有效的来源和图片URL。该网址看起来像 http://www.youtube.com/watch?v=<code> ;将代码(3aICB2mUu2k在这里),并将其插入到URL http://www.youtube.com/e/<code> 中的源代码和 http://img.youtube.com/vi/<code>/0.jpg 为图片。


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 the resulting status message to play the video inline. The video is displayed as an embedded player in the Wall or News feed.


Here's an example of what an embedded video looks like after posting manually.


When posting a link using the Graph API, the video is not embedded.

curl -F 'access_token=...' \
     -F 'message=Link to YouTube' \
     -F 'link=http://www.youtube.com/watch?v=3aICB2mUu2k' \
     https://graph.facebook.com/me/feed


I suspect the answer is related to the source argument, but I'm not sure what the URL should be there. Specifying the same URL just leads to a post with no thumbnail image whatsoever.

source: A URL to a Flash movie or video file to be embedded within the post. read_stream.

How can the same embedded behavior be accomplished by using the Graph API alone?

解决方案

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=<code>; take the code (3aICB2mUu2k here) and insert it into the URLs http://www.youtube.com/e/<code> for the source and and http://img.youtube.com/vi/<code>/0.jpg for the picture.

这篇关于使用Facebook Graph API发布嵌入式视频链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆