2

A few days ago I was asked if it's possible to show the posts of a specific google+ site on a website. I try to explain it more detail:

A concern has google+ account. The same concern has also a website. Now "Cool Concern" want to show all posts from google+ on the newssite of it's website.

I read the Google+ Web API and HTTP API, but nothing seems to satisfy my request.

I know this is an absolute newbie question. But I appreciate any hint:

  • is it in general possible?
  • which API I have to use?

Thanks a lot!

4

1 に答える 1

4

ユーザーと Google+ ページについては、activities.list API 呼び出しを介してアカウントが作成したすべての公開投稿を取得できます。これから、自分のサイトにコンテンツを表示できます。

activities.list API 呼び出しを行うには、関心のあるユーザーまたは Google+ ページの Google+ ID のみが必要です。ユーザーがサイトにログインしている場合は、特別なキーワード'me'を使用して、現在認証されているユーザーを参照できます。 . Python では、これは次のようになります。

activities_resource = service.activities()
request = activities_resource.list(
  userId='me',
  collection='public',
  maxResults='2')

while request != None:
  activities_document = request.execute()
  if 'items' in activities_document:
    print 'got page with %d' % len( activities_document['items'] )
    for activity in activities_document['items']:
      print activity['id'], activity['object']['content']

  request = service.activities().list_next(request, activities_document)

https://developers.google.com/+/api/latest/activities/listで、他の言語での例と詳細を確認できます。

ただし、古いデータがないこと、および Google+ から削除された投稿がアプリに保持されないようにするために、データをキャッシュして定期的に更新する必要があります。完全なデベロッパー ポリシーはhttps://developers.google.com/+/policiesで確認できます。

于 2013-08-22T17:17:44.893 に答える