作为一名新研究人员,我正在尝试获取有关 G+ 上人们之间关系的信息。我想获取其他人的圈子列表以用于某些研究目的。似乎 G+ API 提供了一个网络版本来使用 people.list 和 OAuth2 令牌。我的问题是,people.list 是否支持 c#、java 等编程语言?我尝试使用 c#,但它似乎被服务器阻止了。
有没有办法在 c#、java 等中应用 people.list?如果有,有样品吗?或者有人提供一些开放代码来完成类似的功能?
非常感谢。
以下是我的相关c#代码:
var provider = new NativeApplicationClient(GoogleAuthenticationServer.Description)
{
ClientIdentifier = credentials.ClientId,
ClientSecret = credentials.ClientSecret
};
var auth = new OAuth2Authenticator<NativeApplicationClient>(provider, GetAuthorization);
var servicelist = new PlusService(new BaseClientService.Initializer()
{
Authenticator = auth
});
string userId = "********************";
PeopleResource.ListRequest circle = servicelist.People.List(userId, new PeopleResource.Collection());
circle.MaxResults = 5;
PeopleFeed danielfeed = circle.Fetch();
private static IAuthorizationState GetAuthorization(NativeApplicationClient arg)
{
IAuthorizationState state = new AuthorizationState(new[] { TasksService.Scopes.Tasks.GetStringValue() });
state.Callback = new Uri(NativeApplicationClient.OutOfBandCallbackUrl);
Uri authUri = arg.RequestUserAuthorization(state);
Process.Start(authUri.ToString());
Console.Write(" Authorization Code: ");
string authCode = Console.ReadLine();
Console.WriteLine();
return arg.ProcessUserAuthorization(authCode, state);
}
}
程序在“PeopleFeed danielfeed = circle.Fetch();”处出错 我想我已经通过变量“auth”将 OAuth 令牌传递给 people.list 函数。你能给我一些建议吗?