Google API to get impressions of youtube videos?

As always YouTube APIs doesn’t provide access to a basic feature but here is a workaround: The following answer is similar to the one I wrote about retrieving Unique viewers from the Audience tab. Go on your Video analytics interface in YouTube Studio. Open the Web Developer Tools Network tab of your web-browser (by using … Read more

How to programmatically remove a file from “share with me” in Google drive

The problem is that the user in question doesn’t own the file. After a lot of digging I realised that what you want to do is to remove the permissions for the user on the file in question. The first thing you need to do is run an about.get on the current user: return service.About.Get().Execute(); … Read more

java.lang.NoSuchMethodError: com.google.common.io.ByteStreams.exhaust(Ljava/io/InputStream;)J

With some IDE there’s a plugin to debug this kind of case. Anyway google-api-client 1.22.0, as you can see, depends on guava-jdk5 17. That version is in conflict with google-out-library.oath2-http that need version of guava > 20 Try to modify your pom.xml like this <dependency> <groupId>com.google.api-client</groupId> <artifactId>google-api-client</artifactId> <version>1.22.0</version> <exclusions> <exclusion> <groupId>com.google.guava</groupId> <artifactId>guava-jdk5</artifactId> </exclusion> </exclusions> </dependency> … Read more

Automatically refresh token using google drive api with php script

You don’t have to periodically ask for an access token. If you have a refresh_token, PHP client will automatically acquire a new access token for you. In order to retrieve an refresh_token, you need to set access_type to “offline” and ask for offline access permissions: $drive->setAccessType(‘offline’); Once you get a code, $_GET[‘code’]= ‘X/XXX’; $drive->authenticate(); // … Read more

Google API Client “refresh token must be passed in or set as part of setAccessToken”

I got the same problem recently and i solved it with this. <?php $client->setRedirectUri($this->_redirectURI); $client->setAccessType(‘offline’); $client->setApprovalPrompt(‘force’); I explain ….. Refresh token is not returned because we didnt force the approvalPrompt. The offline mode is not enought. We must force the approvalPrompt. Also the redirectURI must be set before these two options. It worked for me. … Read more