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}");