How to get google plus followers in plain text? JSON or XML https://developers.google.com/+/api/latest/people/get doesn't have followers field key.
问题:
回答1:
Currently there is no way to get followers (or any circle information) from Google+ through the API.
回答2:
You can do using API key, must sure Google plus followers visibility should be public
try on fiddle: https://jsfiddle.net/himstar/j4932w0s/
var profileid = '100520061367519307358';
var apikey = 'AIzaSyAqlZ1MJSGXMSs8q5WbfvLpZTGJeHLVc2w';
var url = 'https://www.googleapis.com/plus/v1/people/' + profileid + '?key=' + apikey;
$.ajax({
type: "GET",
dataType: "json",
url: url,
success: function (data) {
var googlefollowcount = data.circledByCount;
$(".googlefollowercount").html(googlefollowcount);
}
});
回答3:
Actually there is : http://www.emoticode.net/ruby/get-google-page-followers-count-with-google-api.html
require 'open-uri'
require 'json'
google_api_key = 'put your google api key here'
page_id = '105672627985088123672'
data = open("https://www.googleapis.com/plus/v1/people/#{page_id}?key=#{google_api_key}").read
obj = JSON.parse(data)
puts obj['plusOneCount'].to_i
using Ruby.
回答4:
in php:
// get api https://code.google.com/apis/console?hl=en#access
$google_api_key = 'YOUR_API';
$page_id = 'YOUR_PAGE_ID';
$data = @file_get_contents("https://www.googleapis.com/plus/v1/people/$page_id?key=$google_api_key");
$data = json_decode($data, true);
echo $data['plusOneCount'];
回答5:
You can retrieve all of your circles using the People.list method, for example:
...
Plus.People.List listPeople = plus.people().list("me", "visible");
listPeople.setMaxResults(5L);
PeopleFeed peopleFeed = listPeople.execute();
List<Person> people = peopleFeed.getItems();
...
Try the example in the APIs Explorer
回答6:
As of August 2018 the Google+ API endpoint https://www.googleapis.com/plus/v1/people/userId/people/collection
is deprecated.
There is a new endpoint for getting all the contacts: https://people.googleapis.com/v1/people/me/connections
.
There is a metadata
key in the response, and for Google+ contacts it will look somewhat like this:
"metadata": {
"sources": [
{
"updateTime": "2013-01-13T19:16:50.668Z",
"etag": "...",
"type": "CONTACT",
"id": "..."
},
{
"etag": "...",
"type": "PROFILE",
"id": "...",
"profileMetadata": {
"userTypes": [
"GOOGLE_USER",
"GPLUS_USER"
],
"objectType": "PERSON"
}
}
],
"objectType": "PERSON"
}
Note the "GPLUS_USER"
part.