Facebook Graph Api 2.1从用户名获取用户名 [英] Facebook Graph Api 2.1 get userid from username

查看:148
本文介绍了Facebook Graph Api 2.1从用户名获取用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个解决方案,可以通过配置文件url或fb username为您提供用户ID

I am looking for a solution which can provide me user id from profile url or fb username

example :http://facebook.com/username

获取此网址的用户名

,当我尝试阅读朋友(我有朋友相关的许可),我得到空白数据数组ex:

and also when I try to read friends (I have friend related permission), I am getting blank data array ex:

 graph api requ: https://graph.facebook.com/v2.1/me/friends?access_token=xxxxx
 response:
    {
      "data": [
      ], 
      "summary": {
        "total_count": 455
      }
    }

请让我知道如何通过Facebook图表中的用户名获取好友列表和userid api v2.1

Please let me know how can I get friend list and userid using username in Facebook graph api v2.1

推荐答案

graph.facebook.com/username已停止工作。有一个不愉快的解决方法。在我有限的测试中,这在Chrome中有效。

graph.facebook.com/username has stopped working. There is an unpleasant workaround. In my limited testing, this works in Chrome.

无论您在时间轴条目中看到facebook用户名,只需点击检查元素即可。在打开的窗口中,向上滚动一下,查找字符串:

Wherever you see the facebook user name in a timeline entry, right click and select "inspect element." In the window that opens, scroll up a little and look for the string:

data-hovercard =/ ajax / hovercard / hovercard.php?id =

您右键点击的用户名的Facebook标识符为=符号。

The Facebook id of the username you right clicked on follows the = sign.

这只适用于时间轴上的名称。

This only seems to work on names on the timeline.

这篇关于Facebook Graph Api 2.1从用户名获取用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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