Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Facebook graph api 如何使用C#查询Facebook评论插件评论信息?_Facebook Graph Api_C# 4.0_Facebook Comments - Fatal编程技术网

Facebook graph api 如何使用C#查询Facebook评论插件评论信息?

Facebook graph api 如何使用C#查询Facebook评论插件评论信息?,facebook-graph-api,c#-4.0,facebook-comments,Facebook Graph Api,C# 4.0,Facebook Comments,我正在尝试从中获取评论信息(向下滚动至**评论插件代码生成器*部分) 我正在使用中的FacebookClient类获取数据。我的代码如下: string oauthUrl = $"https://graph.facebook.com/oauth/access_token?type=client_cred&client_id={appId}&client_secret={appSecret}"; string accessToken = client.DownloadString

我正在尝试从中获取评论信息(向下滚动至**评论插件代码生成器*部分)

我正在使用中的
FacebookClient
类获取数据。我的代码如下:

string oauthUrl = $"https://graph.facebook.com/oauth/access_token?type=client_cred&client_id={appId}&client_secret={appSecret}";

string accessToken = client.DownloadString(oauthUrl).Split('=')[1];

// this is included as a sanity check that the client can fetch data (correct token, proper calls)    
var fbClient = new FacebookClient(accessToken);
var fbData = fbClient.Get("/wikipedia/").ToString();
var info = JsonConvert.DeserializeObject<FacebookPageInfo>(fbData);
fbData = fbClient.Get("/wikipedia/posts").ToString();
var posts = JsonConvert.DeserializeObject<FacebookPostData>(fbData);

// this is the code the actually should fetch comments content
// this is the data-href value retrieved from inspecting rendered page
var pageUrl = HttpUtility.UrlDecode("https://developers.facebook.com/docs/plugins/comments#configurator"); 
var fbComments = fbClient.Get($"/{pageUrl}/comments");

问题:我如何获取实际的评论内容?

多亏了
CBroe
我成功地构建了请求,并朝着获取评论信息迈出了另一步:

  • \configurator
    url中的书签错误(必须删除)

  • 获取数据的正确代码

    var pageUrl = HttpUtility.UrlDecode("https://developers.facebook.com/docs/plugins/comments");
    var fbComments = fbClient.Get($"https://graph.facebook.com/v2.6/?fields=og_object{{comments}}&id={pageUrl}");
    
  • pageUrl
    放入Chrome会得到评论,但在IE11和C#code中失败。但是,这是另一个问题的另一个问题

    var pageUrl = HttpUtility.UrlDecode("https://developers.facebook.com/docs/plugins/comments");
    var fbComments = fbClient.Get($"https://graph.facebook.com/v2.6/?fields=og_object{{comments}}&id={pageUrl}");