本文介绍了编程地添加和YouTube视频到墙上的帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Facebook墙上嵌入YouTube影片?我试图通过源成员传递视频网址,但没有工作。检查手动发布的json之后,我看到FB的服务器代码有一些处理方式可以实现。



Feed显示了我这个:

 id:100001460921297_170524112986785,
from:{
name:Fw As
id:100001460921297
},
message:在SBSR 2010年7月16日葡萄牙,
picture:http://external.ak .fbcdn.net / safe_image.php?d = 9f79134b5acff03a2d60adb0320dbc8b& w = 130& h = 130& url = http%3A%2F%2Fi.ytimg.com%2Fvi%2FTOypSnKFHrE%2F0.jpg,
:http://www.youtube.com/watch?v=TOypSnKFHrE,
source:http://www.youtube.com/v/TOypSnKFHrE&autoplay=1,
name:The Strokes - Last Nite,
caption:www.youtube.com,
description:音乐视频由The Strokes perform Last Nite。(C )2001 BMG,
icon:http://static.ak.fbcdn.net/rsrc.php/yj/r/v2OnaT yTQZE.gif,

有没有办法通过c#sdk来实现?



任何想法?



感谢和快乐的圣诞节

解决方案

如果您使用Facebook C#SDK,则在成功的身份验证和授权后,您需要发布链接。

我假设_FacebookApp是FacebookApp类的实例,您已获得授权,则代码将为:

 code> var parameters = new Dictionary< string,object>(); 

parameters.Add(message,Commentary);
parameters.Add(link,Link);
if(!String.IsNullOrEmpty(ThumbnailImageUrl))
parameters.Add(picture,ThumbnailImageUrl);

尝试
{
_FacebookApp.Post(me / feed,参数);
}
catch(Exception ex)
{
return ex.Message;
}

其中Commentary是用户关于此链接的可选消息,例如:这个网址是分享的,例如:http://www.youtube.com/watch?v = _OBlgSz8sSM,



ThumbnailImageUrl是链接帖子中使用的缩略图的URL,例如:http://i.ytimg.com/vi/_OBlgSz8sSM/0.jpg



希望有帮助。



干杯。


How can i embeded an youtube video in the facebook wall? I tried to pass the video url using the "source" member, but didn't work. After checking the json of a feed posted manually i see that there is some handling by FB's server code to make it happen.

The feed shows me this:

"id": "100001460921297_170524112986785",
         "from": {
            "name": "Fw As",
            "id": "100001460921297"
         },
         "message": "In SBSR 16 July 2010 Portugal",
         "picture": "http://external.ak.fbcdn.net/safe_image.php?d=9f79134b5acff03a2d60adb0320dbc8b&w=130&h=130&url=http%3A%2F%2Fi.ytimg.com%2Fvi%2FTOypSnKFHrE%2F0.jpg",
         "link": "http://www.youtube.com/watch?v=TOypSnKFHrE",
         "source": "http://www.youtube.com/v/TOypSnKFHrE&autoplay=1",
         "name": "The Strokes - Last Nite",
         "caption": "www.youtube.com",
         "description": "Music video by The Strokes performing Last Nite. (C) 2001 BMG",
         "icon": "http://static.ak.fbcdn.net/rsrc.php/yj/r/v2OnaTyTQZE.gif",

Is there way to achieve this via the c# sdk? I couldn't find any info helpfull about it so far.

Any ideas?

Thanks and merry christmas!

解决方案

If you use Facebook C# SDK, then after successful authentication and authorization you need to post a link.

I assume that _FacebookApp is instance of FacebookApp class and you are authorized, then the code will be:

        var parameters = new Dictionary<string, object>();

        parameters.Add("message", Commentary);
        parameters.Add("link", Link);
        if (!String.IsNullOrEmpty(ThumbnailImageUrl))
            parameters.Add("picture", ThumbnailImageUrl);

        try
        {
            _FacebookApp.Post("me/feed", parameters);
        }
        catch (Exception ex)
        {
            return ex.Message;
        }

where Commentary is an optional message from the user about this link, e.g.: "Guys, check it out",

Link is the URL that was shared, e.g.:"http://www.youtube.com/watch?v=_OBlgSz8sSM",

ThumbnailImageUrl is a URL to the thumbnail image used in the link post, e.g.:"http://i.ytimg.com/vi/_OBlgSz8sSM/0.jpg".

Hope it will help.

Cheers.

这篇关于编程地添加和YouTube视频到墙上的帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 03:10