Facebook api从我的墙上发帖子 [英] Facebook api get post from my wall

查看:334
本文介绍了Facebook api从我的墙上发帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!我有一些问题。我需要计算一些像某人的帖子。所以我想知道这篇文章的身份。首先,我需要阅读我墙上的所有帖子。你能打倒我吗?我使用FacebookClient在墙上发布消息。那么我可以使用FacebookClient阅读所有帖子吗?谢谢。

解决方案

我解决了我的问题

尝试

{

string str = client.Get(/ me / feed)。ToString();

JObject obj = JObject.Parse(str);

JToken jUser = obj [ data];

int numb = jUser.Count();

int id_post = 0;

for(int i = 0; i < numb; i ++)

{

if(obj [data] [i] [id]。ToString()== id_mypost)

{

id_post = i;

}

}

string strr = obj [ data] [id_post] [likes]。ToString();



string pattern = @id;

int count_like = 0;

正则表达式newReg =新正则表达式(模式);

MatchCollection匹配= newReg.Matches(strr);

foreach(匹配席位)

{

count_like ++;

}

}


Hi ! I have some problem. I need to count a number of like of someone post. So I wouls like to get a id of this post. So first of all I need to read all post on my wall. Can you halp me? I post my message on my wall using FacebookClient. So can I read all posts using FacebookClient ? Thanks.

解决方案

I solved my problem
try
{
string str = client.Get("/me/feed").ToString();
JObject obj = JObject.Parse(str);
JToken jUser = obj["data"];
int numb = jUser.Count();
int id_post = 0;
for (int i = 0; i < numb; i++)
{
if (obj["data"][i]["id"].ToString() == id_mypost)
{
id_post = i;
}
}
string strr = obj["data"][id_post]["likes"].ToString();

string pattern = @"id";
int count_like = 0;
Regex newReg = new Regex(pattern);
MatchCollection matches = newReg.Matches(strr);
foreach (Match mat in matches)
{
count_like++;
}
}


这篇关于Facebook api从我的墙上发帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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