Facebook api从我的墙上发帖子 [英] Facebook api get post from my wall
本文介绍了Facebook api从我的墙上发帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
我解决了我的问题
尝试
{
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屋!
查看全文