我正在使用Youtube API V3,但无法找到有关如何按类别过滤的文档:
这是我的代码:
$results = $youtube->search->listSearch('id,snippet', array(
'q' => $_GET['q'],
'maxResults' => 20,
'type' => 'video'
'videoCategoryId' => 'what-do-i-put-here?',
));
Run Code Online (Sandbox Code Playgroud)
我一直在阅读他们的文档一个小时,似乎找不到任何关于如何找出各类别ID的参考.在我的情况下,我正在寻找音乐的videoCategoryId ....
给出以下嵌入代码:
<iframe src="https://www.google.com/calendar/embed?
title=2014 PLIDAM International Symposium (Paris)&
dates=20140611/20140615&
mode=WEEK&
showNav=1&
showDate=1&
showPrint=1&
showTabs=1&
showCalendars=0&
showTz=1;
height=600&
wkst=2&
bgcolor=%23666666&
src=vdfmfbp0msroletduigs2qtkoc%40group.calendar.google.com&
color=%232952A3&
ctz=Europe%2FParis"
style=" border:solid 1px #777 " width="800" height="600" frameborder="0" scrolling="no"></iframe>
Run Code Online (Sandbox Code Playgroud)
是否有一个参数来设置从09:00到18:00(下午6点)显示/ focus_on的小时数,即工作时间?几天相同,是否只有4天才能显示/聚焦权利.
我创建了一些填充谷歌电子表格的工具.它工作正常1年,因为今天我错了
Exception in thread "main" com.google.gdata.util.AuthenticationException: Error authenticating (check service name)
at com.google.gdata.client.GoogleAuthTokenFactory.getAuthException(GoogleAuthTokenFactory.java:688)
at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:560)
at com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(GoogleAuthTokenFactory.java:397)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:364)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:319)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:303)
Run Code Online (Sandbox Code Playgroud)
这是与gmail连接的代码部分:
String USERNAME = "usename@........com"; ->of course I'm using proper username and password
String PASSWORD = "*******";
SpreadsheetService service
= new SpreadsheetService("SandboxCheck");
service.setUserCredentials(USERNAME, PASSWORD);
Run Code Online (Sandbox Code Playgroud)
我不知道如何连接gmail,我试图通过oAuth这样做,但我不知道如何做到这一点.在https://developers.google.com/google-apps/spreadsheets/authorize上的示例中,只有.net的代码.
没有关于如何将Java Translate API Cliente库用于java的示例.
在此页面中,Google建议搜索其API的示例,但Google Translate API没有一个示例:https://github.com/google/google-api-java-client-samples
由于我没有找到任何谷歌翻译API的例子,我没有任何关于如何使用他们的官方Java库的线索.
我想提出一个简单的请求,将文本(例如Hello World从英语翻译成西班牙语)与Google制作的官方图书馆:https://developers.google.com/api-client-library/java/apis/translate/v2但没有可供公众使用的文档或示例.
有没有人知道如何在java中使用谷歌翻译API客户端库,我已经google了,我根本没有运气.
我已经将所有jar包含在我的项目中,但是我不知道我必须使用哪些类或者哪些对象实例化以便从一种语言转换为另一种语言.我根本不知道.我只需要像其他Google API的示例存储库中那样简单地剪切代码.
我正在使用youtube api.当我点击此网址时" https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3D%3DMINE&start-date=2015-01-01&end-date=2016-01-31&metrics=likes% 2Cdislikes&key = {API Key} "
它给了401
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
Run Code Online (Sandbox Code Playgroud)
但是我在浏览器中点击了" https://developers.google.com/apis-explorer/?" 它工作正常.
如何使第一个请求起作用?
google-api google-oauth youtube-data-api youtube-analytics-api
我正在尝试实现 SMS Retriever API 以进行 SMS 验证。文档中提到的官方方式说GoogleApiClient与HintRequest从设备检索手机号码一起使用
HintRequest hintRequest = new HintRequest.Builder()
.setPhoneNumberIdentifierSupported(true)
.build();
PendingIntent intent = Auth.CredentialsApi.getHintPickerIntent(
googleApiClient, hintRequest);
try {
startIntentSenderForResult(intent.getIntentSender(),
RESOLVE_HINT, null, 0, 0, 0);
} catch (IntentSender.SendIntentException e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
但是GoogleAPIClient已弃用并由GoogleApi接口代替,例如GoogleSignInClient. 我尝试使用GoogleSignInClient但getHintPickerIntent不接受。即使在被弃用后使用旧 API 是否安全,或者有没有办法将后者与 SMSRetriver API 一起使用?
android google-api google-api-client googlesigninapi sms-retriever-api
我正在使用谷歌日历API.这就是我想要的,一旦你给予应用程序许可,我总是可以使用该应用程序,而无需每天访问.我一直听说我需要保存访问令牌或使用刷新令牌来做我想做的事情.这就是问题,你是怎么做到的?代码如何?我已经尝试将令牌保存在cookie中,但一小时后,访问令牌已过期.如何让用户保持登录状态?
PS:请给我解释代码示例.
这是我的代码(使用CakePHP):
$client = new Google_Client();
$client->setApplicationName("Wanda3.0 Agenda");
$cal = new Google_CalendarService($client);
if (isset($_GET['code'])) {
$client->authenticate($_GET['code']);
$_SESSION['token'] = $client->getAccessToken();
header('Location: http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);
}
if (isset($_SESSION['token'])) { $client->setAccessToken($_SESSION['token']); }
if ($client->getAccessToken()) {
/************* Code entry *************/
}else{
/************* Not connected to google calendar code *************/
$authUrl = $client->createAuthUrl();
$returnArr = array('status' => 'false', 'message' => "<a class='login' href='$authUrl'>Connect Me!</a>");
return $returnArr;
}
Run Code Online (Sandbox Code Playgroud) 我正在测试通过谷歌访问令牌获取用户信息
点击登录按钮后,我被重定向到
https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=access_token_here
并获得这样的一些JSON数据
{
"issued_to": "my client id.apps.googleusercontent.com",
"audience": "my client id.apps.googleusercontent.com",
"user_id": "user id here",
"scope": "https://www.googleapis.com/auth/plus.login",
"expires_in": 3596,
"access_type": "online"
}
Run Code Online (Sandbox Code Playgroud)
现在我需要知道如何提取用户名,地址和电子邮件任何帮助吗?
提前致谢
我正在尝试使用以下"旧"代码从服务器上使用google-api进行身份验证:
GoogleTokenResponse tokenResponse =
new GoogleAuthorizationCodeTokenRequest(TRANSPORT, JSON_FACTORY,
CLIENT_ID, CLIENT_SECRET, code, "postmessage").execute();
// Create a credential representation of the token data.
GoogleCredential
credential = new GoogleCredential.Builder()
.setJsonFactory(JSON_FACTORY)
.setTransport(TRANSPORT)
.setClientSecrets(CLIENT_ID, CLIENT_SECRET).build()
.setFromTokenResponse(tokenResponse);
Run Code Online (Sandbox Code Playgroud)
从用于java的旧版google-api开始,JSON_FACTORY的构建方式如下:
JsonFactory JSON_FACTORY = new JacksonFactory();
Run Code Online (Sandbox Code Playgroud)
但是因为我已经更新到版本1.15.0-rc,所以找不到JacksonFactory.看起来它已经被重构或删除,但我找不到任何替换这行代码的例子.
我该怎么用?肯定会实现JsonFactory,但是某些标准实现可能已经存在?
尝试使用我自己的帐户授权我的应用时收到此错误:
Your project is trying to access scopes that need to go through the verification process.
{invalid=https://www.googleapis.com/auth/contacts}
If you need to use one of these scopes, submit a verification request. Learn More
Run Code Online (Sandbox Code Playgroud)
当我使用其他帐户时,错误消息是不同的:
This app hasn’t been verified to access:
{invalid=https://www.googleapis.com/auth/contacts}
Are you the developer? If this project needs these scopes, sign in to an account with access to edit your project and try again.
If not, contact the developer for help.
Run Code Online (Sandbox Code Playgroud) google-api ×10
google-oauth ×3
java ×3
gmail-api ×2
php ×2
access-token ×1
android ×1
api ×1
iframe ×1
jackson ×1
json ×1
oauth-2.0 ×1
signing ×1
youtube ×1
youtube-api ×1