我写了下一段代码:
var client = new FacebookClient();
string str, profile_name;
foreach (var myFriend in @Model.Friends.Data)
{
str = myFriend.Link.ToString();
profile_name = str.Substring(@str.LastIndexOf('/') + 1);
dynamic me = client.Get(profile_name);
}
它会传递我朋友列表的所有链接(例如:http://www.facebook.com/mariah.carey.62),只接受最后一个字符串后的字符串:/
(在这种情况下为mariah.carey.62
),然后获取公共信息(性别,姓名等)。
我的问题是:似乎很少有链接:http://www.facebook.com/profile.php?id=0123456789。然后,profile_name
是:profile.php?id=0123456789
。假设我成功发送:client.Get(“0123456789”)。这个用户的图表似乎是:
"id": "0123456789",
"name": "\u05d0\u05e1\u05e0\u05ea \u05d0\u05d4\u05e8\u05d5\u05df",
"first_name": "\u05d0\u05e1\u05e0\u05ea",
"last_name": "\u05d0\u05d4\u05e8\u05d5\u05df",
"link": "https://www.facebook.com/people/\u05d0\u05e1\u05e0\u05ea-
\u05d0\u05d4\u05e8\u05d5\u05df/0123456789",
"gender": "female",
(图表位于:http://graph.facebook.com/0123456789)
如何获得该用户可理解的数据?我得到的名字什么也没告诉我。也许有办法解密它。
答案 0 :(得分:1)
我用过:
System.Text.RegularExpressions.Regex.Unescape(str);