【问题标题】:Accessing collections data from Google+ API从 Google+ API 访问集合数据
【发布时间】:2018-06-25 08:55:12
【问题描述】:

我正在使用 Google Plus API,JSON 响应中似乎没有关于帖子集合的信息。我想知道是否有办法使用 API 数据访问帖子所属的集合。

例如,我们可以使用给定的 URL 来解析网页中的集合吗?有谁知道如何以高效的方式完成这项工作?

【问题讨论】:

    标签: google-api google-plus google-apis-explorer


    【解决方案1】:

    google+ api 是一个只读 api,它允许您访问人员、活动和 cmets。

    活动列表返回用户所有activities#resource 帖子的列表。 try it

    您可以发送的唯一集合是公开的。响应看起来像这样。

      {
       "kind": "plus#activity",
       "etag": "\"RKS4-q7QGL10FxltAebpjqjKQR0/82jivrLU7ubQ-fwlLaXGSt3krb8\"",
       "title": "",
       "published": "2018-06-18T07:03:54.034Z",
       "updated": "2018-06-18T07:03:54.034Z",
       "id": "z13lu3vowpa5x3aws04chl2brzavs1rplos0k",
       "url": "https://plus.google.com/+LindaLawton/posts/STgianNMQwU",
       "actor": {
        "id": "117200475532672775346",
        "displayName": "Linda Lawton",
        "url": "https://plus.google.com/117200475532672775346",
        "image": {
         "url": "https://lh5.googleusercontent.com/-a1CWlFnA5xE/AAAAAAAAAAI/AAAAAAAAl1I/UcwPajZOuN4/photo.jpg?sz=50"
        },
        "verification": {
         "adHocVerified": "UNKNOWN_VERIFICATION_STATUS"
        }
       },
       "verb": "post",
       "object": {
        "objectType": "note",
        "actor": {
         "verification": {
          "adHocVerified": "UNKNOWN_VERIFICATION_STATUS"
         }
        },
        "content": "",
        "url": "https://plus.google.com/+LindaLawton/posts/STgianNMQwU",
            "replies": {
             "totalItems": 0,
             "selfLink": "https://content.googleapis.com/plus/v1/activities/z13lu3vowpa5x3aws04chl2brzavs1rplos0k/comments"
            },
            "plusoners": {
             "totalItems": 0,
             "selfLink": "https://content.googleapis.com/plus/v1/activities/z13lu3vowpa5x3aws04chl2brzavs1rplos0k/people/plusoners"
            },
            "resharers": {
             "totalItems": 0,
             "selfLink": "https://content.googleapis.com/plus/v1/activities/z13lu3vowpa5x3aws04chl2brzavs1rplos0k/people/resharers"
            },
            "attachments": [
             {
              "objectType": "article",
              "displayName": "leastprivilege/AspNetCoreSecuritySamples",
              "content": "AspNetCoreSecuritySamples - Samples for various ASP.NET Core Security Features",
              "url": "https://github.com/leastprivilege/AspNetCoreSecuritySamples",
              "image": {
               "url": "https://lh3.googleusercontent.com/proxy/1pdxjC-TsuF0-8yHOZKvfDOXG1pNWAIemDoW7OzrFy8pcckGqr0BTJj-TwgW9KgEuoGLJjfUKLWSCouJwTT7FjoOmZ_xURQwzz4=w506-h910",
               "type": "image/jpeg",
               "height": 910,
               "width": 506
              },
              "fullImage": {
               "url": "https://avatars0.githubusercontent.com/u/1454075?s=400&v=4",
               "type": "image/jpeg"
              }
             }
            ]
           },
           "provider": {
            "title": "Google+"
           },
           "access": {
            "kind": "plus#acl",
            "description": "Public",
            "items": [
             {
              "type": "public"
             }
            ]
           }
          },
    

    上面的帖子here 实际上是我的收藏之一。但是在响应中没有提到它所在的集合的 id 是 olLcVE

    正如我提到的,这是一个非常有限的 api,您想要做的事情不可用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-13
      • 2023-03-13
      • 1970-01-01
      • 1970-01-01
      • 2017-10-16
      • 1970-01-01
      相关资源
      最近更新 更多