【问题标题】:google+ api person's friendsgoogle+ api 人的朋友
【发布时间】:2011-10-07 04:40:15
【问题描述】:

我正在尝试制作一个基于 google+ api 的网站。我刚开始研究 api,似乎他们没有像 facebook 那样提取一个人的圈子和朋友的方法。该 api 实际上非常小,我想确保我没有错过任何东西。那么有没有人使用 google+ api 并从用户的个人资料中提取朋友信息。

【问题讨论】:

    标签: javascript api google-plus


    【解决方案1】:

    有一个未记录的 API。 Google+ 发出这些调用以呈现 Google+ 页面:

    在 X 的圈子里:

    https://plus.google.com/u/0/_/socialgraph/lookup/visible/?o=%5Bnull%2Cnull%2C%22GOOGLEPLUSUSERID%22%5D&rt=j

    在谁的圈子里?

    https://plus.google.com/u/0/_/socialgraph/lookup/incoming/?o=%5Bnull%2Cnull%2C%22GOOGLEPLUSUSERID%22%5D&n=1000&rt=j

    通过Fragment: Looking up Who’s in Whose Google+ Circles…


    查看 Google+ 源代码会发现一大堆其他 URL:

    var cRa = new UD("/_/socialgraph/lookup/circles/", ND, "Error loading circles"),
        dRa = new UD("/_/socialgraph/lookup/circles_changes/", ND, "Error loading circles changes");
    new UD("/_/socialgraph/lookup/external_sites/", WQa, "Error loading external sites");
    var eRa = new UD("/_/socialgraph/lookup/visible/", ND, "Error loading people in common"),
        fRa = new UD("/_/socialgraph/lookup/incoming/", ND, "Error loading people that have the user in public circles"),
        gRa = new UD("/_/socialgraph/lookup/followers/", ND, 'Error loading "People who\'ve added you"'),
        hRa = new UD("/_/socialgraph/lookup/ignored/", ND, "Error loading people you've ignored");
    new UD("/_/socialgraph/lookup/followingcircles/", XQa, "Error loading your circles");
    var iRa = new UD("/_/socialgraph/mutate/modifyfollowingcircles/", SD, "Error modifying your circles"),
        jRa = new UD("/_/socialgraph/lookup/people/", ND, "Failed lookup");
    new UD("/_/socialgraph/lookup/follower/", VQa, "Error loading whether a person has added you");
    var kRa = new UD("/_/socialgraph/lookup/settings/", QD, "Error loading settings"),
        lRa = new UD("/_/socialgraph/mutate/settings/", bRa, "Error storing settings"),
        mRa = new UD("/_/socialgraph/lookup/find_more_people/", ID, 'Error loading "Find people"'),
        nRa = new UD("/_/socialgraph/lookup/close_friend_suggestions/", ID, "Error loading close friend suggestions"),
        oRa = new UD("/_/socialgraph/lookup/check_imports/", PQa, "Error loading newly imported people"),
        pRa = new UD("/_/socialgraph/get/circlenamesuggestions/", JD, "Error fetching suggested circle names");
    new UD("/_/socialgraph/get/num_invites_remaining/", TQa, "Failed to get number of invites remaining");
    var qRa = new UD("/_/socialgraph/get/invite_token/", SQa, "Failed to get invite token"),
        rRa = new UD("/_/socialgraph/get/inviters/", RQa, ""),
        sRa = new UD("/_/socialgraph/mutate/create/", QQa, "Error creating circle"),
        tRa = new UD("/_/socialgraph/mutate/modifymemberships/", HD, "Error changing circle memberships."),
        uRa = new UD("/_/socialgraph/mutate/removemember/", TD, "Error removing members from circle"),
        vRa = new UD("/_/socialgraph/mutate/revert/", aRa, "Error occured while trying to undo your last action"),
        wRa = new UD("/_/socialgraph/mutate/properties/", RD, "Error changing circle properties"),
        xRa = new UD("/_/socialgraph/mutate/sortorder/", YQa, "Error reordering circles"),
        yRa = new UD("/_/socialgraph/mutate/delete/", KD, "Error deleting circle"),
        zRa = new UD("/_/socialgraph/mutate/deletemem/", LD, "Error deleting people"),
        ARa = new UD("/_/socialgraph/mutate/block_user/", GD, "Error blocking user"),
        BRa = new UD("/_/socialgraph/mutate/block_user/", GD, "Error unblocking user"),
        CRa = new UD("/_/socialgraph/mutate/block_user/", GD, "Error reporting and blocking user"),
        DRa = new UD("/_/socialgraph/mutate/removefromcontacts/", ZQa, "Error removing people from contacts");
    new UD("/_/socialgraph/lookup/circlepicker/", MD, "Error loading circles data");
    var ERa = new UD("/_/socialgraph/lookup/hovercards/", PD, "Error loading hovercard data"),
        FRa = new UD("/_/socialgraph/lookup/peopleincommon/", ND, "Error loading people in common"),
        GRa = new UD("/_/socialgraph/notification/invite/", UQa, "Error inviting members"),
        HRa = new UD("/_/socialgraph/mutate/block_user/", GD, "Error ignoring members"),
        IRa = new UD("/_/socialgraph/mutate/block_user/", GD, "Error unignoring members");
    

    【讨论】:

      【解决方案2】:

      目前,Google+ API 是早期的开发者预览版。您唯一能做的就是以只读方式访问 public 信息。但是,对于有关 Google Plus 平台的错误和功能请求,有一个官方问题跟踪器。

      更具体地说,还有一个open issue for the feature you want to have(访问圈子和朋友)。确保在此问题上“加注星标”,以便在方法最终可用时收到通知。此外,为该问题加注的人越多,它就越有可能很快发布(显然,Google 员工浏览此列表以确定哪些功能需要很多,哪些不需要)。

      编辑: 正如 Nicholas 指出的那样,现在确实可以使用 retrieve a list of friends using people/list,前提是您使用新的 auth.login OAuth 范围,这将使您能够访问所有被用户已选择与您的应用程序共享。

      【讨论】:

      【解决方案3】:

      我使用了 Google+ API,但他们没有提供任何与朋友相关的内容。

      【讨论】:

        【解决方案4】:

        看起来它现在可用!这是文档:https://developers.google.com/+/api/latest/people/get

        请求

        GET https://www.googleapis.com/plus/v1/people/**userId**/people/**collection**
        

        userId - 字符串 - 要获取的用户 ID。

        collection - 字符串 - 要列出的人员的集合。

        回应

        如果成功,则此方法返回具有以下结构的响应正文:

        {
          "kind": "plus#peopleFeed",
          "etag": etag,
          "selfLink": string,
          "title": string,
          "nextPageToken": string,
          "totalItems": integer,
          "items": [
            people Resource
          ]
        }
        

        需要范围 - https://www.googleapis.com/auth/plus.login

        【讨论】:

        • 这现在在我的生产应用程序中运行良好。去谷歌的方式!
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-03-26
        • 2015-10-21
        • 1970-01-01
        • 2012-05-20
        相关资源
        最近更新 更多