How to get Read-only Youtube API access - youtube-api

For YouTube APIs, the only scope that is document is http://gdata.youtube.com, which asks the user to grand full read/write access. Is there a scope that asks/grants read-only permissions OR just read permissions to Youtube Insight data?

v3 of the YouTube Data API now has support for a read-only scope: https://www.googleapis.com/auth/youtube.readonly
Tokens obtained with that scope won't work with the older v1/v2 of the API, though. You can only use them with v3 calls.

Found out from one of the YouTube API guys (4/16/12):
"It's not possible with the current API, unfortunately. There's just a
single scope that grants full read/write access to the account. This
is a valid request, though, and I'll pass it along to the engineering
team. I can't make any promises about whether it will be implemented,
though."

The read-only analytics permission (https://www.googleapis.com/auth/analytics.readonly) used to work under v2 as well and it's even in the docs: https://developers.google.com/analytics/devguides/reporting/core/v2/gdataAuthentication
However it doesn't work now and Google doesn't look very motivated to fix it: http://code.google.com/p/gdata-issues/issues/detail?id=3916

Related

How do I use the YouTube Data API to upload video to secondary channel on personal account

I have looked around Stack Overflow and seen a few posts about this but none of the solutions help.
I have a Google account which I use in YouTube. I have created a second channel on that YouTube account so that I can upload videos with a specific theme to separate them from the main videos.
Trying to use the Google API to upload the videos so that I can run it via a Python script, I keep hitting brick walls with Google who is looking for app verification, privacy policies and web page links - none of which I have.
This application is a Python script that's not available to the public and doesn't gather any public information. All I am trying to do is upload videos to my own personal YouTube account.
So I'm beginning to think it is something else I should be using rather than the API (the uploading web page isn't suitable for use in a script).
My two question are:
Can I use the YouTube API to upload a video directly to the second channel on my personal YouTube account?
Is there another simpler mechanism I should be using to upload videos via a script to my personal YouTube account? The reason I have to do it via script is that the device is unattended.
Thanks,
David
You have to acknowledge that each and every app (this to be understood in a broad sense that includes even a small script like this one from Google upload_video.py) must be verified and approved by Google prior to be able to make videos publicly available via the YouTube site.
Answer to question no. 1: yes, that is perfectly possible.
As part of the OAuth 2.0 authentication/authorization flow, you will be presented, within the browser, with the option of selecting to which account your app is to be given access rights.
You may well exercise this behavior, prior to making use of your script, with the help of Google Developers OAuth 2.0 Playground.
Upon a successful OAuth flow, you may verify (and also revoke) the permissions granted by your account on the account's permissions page.
Answer to question no. 2: no, there's no way to upload programmatically videos on YouTube that's in compliance with YouTube's DTOS, other than using the Videos.insert API endpoint.
Addendum
Since by now you have at least two credentials sets, it may be of need to know to which of your YouTube channels a given credentials object is associated.
If using the Google APIs Client Library for Python, you may easily obtain from the API the channel ID to which a given credentials object CREDENTIALS is associated by issuing a call to the Channels.list API endpoint, passing to it the parameter mine as mine=true:
from googleapiclient.discovery import build
youtube = build(
'youtube', 'v3',
credentials = CREDENTIALS)
response = youtube.channels().list(
mine = 'true',
part = 'id',
fields = 'items(id)',
maxResults = 1
).execute()
channel_id = response['items'][0]['id']
Note that the code above uses the fields request parameter for to obtain from the Channels.list endpoint only the channel's ID info (it is always good to ask from the API only the info that is of actual use).
A caveat using the above procedure is the following: if a given CREDENTIALS instance has its scopes containing only:
https://www.googleapis.com/auth/youtube.upload,
then the API will respond with an error of type insufficientPermissions and of message Request had insufficient authentication scopes.
For to invoke successfully the Channels.list it would be sufficient that the scopes attached to CREDENTIALS to include either of the one below:
https://www.googleapis.com/auth/youtube.readonly,
https://www.googleapis.com/auth/youtube.

Youtube v3 API comment retrieval with commentThreads.list endpoint

I am using commentThreads.list endpoint in Youtube v3 API to get all the comments for particular videos. This works well for us, however, this endpoint requires youtube.force-ssl scope which is a pretty sensitive one. The doc says that this scope is the only option. The issue is that the user gets a warning screen upon connecting the account:
At this point, users become concerned about the permissions that they are giving to our app, as youtube.force-ssl scope gives the app a bunch of sensitive permissions as "See, edit, and permanently delete your YouTube videos, ratings, comments and captions", according to the doc
Why Youtube v3 API comment retrieval with commentThreads.list endpoint requires such a sensitive scope and is there an alternative way to retrieve all comments for my videos? Now looks like the only option is to get through the verification.
P.S. I know that may seem more a discussion topic, however, that looks like an overkill to give such set of permissions to retrieve the information that is available publicly on the page, so I am looking for possible alternatives.

how can I add people to my Brand Account over api?

I have the access token of a youtube Brand Account owner. With this token I would like to add other people (as admin) to this account over API.
This operation is possible manually (info : https://support.google.com/youtube/answer/4628007?hl=en), but I didn't see anything about user management on youtube-data api.
is this operation is impossible over API or am I looking at the wrong google API documentation ?
It doesn't look like the YouTube v3 Data API supports this operation :(. The only other APIs are analytics and reporting.
For a complete list of what the Data API can do check out this link:
https://developers.google.com/apis-explorer/#s/youtube/v3/
It's not possible with the current YouTube API. If this operation is manually possible over webpages, you can simply write a program (e.g. nodejs application) to execute the steps needed, automatically.

YouTube API from V2 to V3 migration

I'm still using old V2 api and now i get https://youtube.com/devicesupport.
My current request is:
https://gdata.youtube.com/feeds/api/users/{username}/uploads?alt=jsonc&max-results=15&v=2
There is no authentication required to make that call
Question:
Any idea how to achieve the same with new Google V3 API? I check documentation but didn't found answer for that.
I had the same problem with V3 api. I think you can't access videos informations without authentication anymore, but you don't need to use an OAuth to get a snippet from some video or search. I was searching a simple solution for my app, because I just want to request title, thumb and descriptions.
The new url will be:
https://www.googleapis.com/youtube/v3/videosid={VIDEO_ID}&part=snippet&key={YOU_API_KEY}
You need to access google developers console, enable youtube api and your public access key - on credentials (API KEY), so they can relate your app to all requests.
And I found this example in PHP if you need to parse JSON result:
http://www.leenooks.com/php/parsing-youtube-v3-json-with-php-examples.html
I'm still don't know all the limitations of V3, I was using V2 too, but maybe for uploads, or more control for youtube accounts you'll have to use OAuth.
I hope this will help you.

How to allow users to upload video from my website to my youtube account?

Is it possible to allow uses to upload video to my youtube account with v3 api? I want allow users to upload video through my website to youtube but not ask them to login to their youtube account. I know it was possible in v2 api. Is it also doable in v3 api?
I've tried so hard to do the same thing as you /w the v3 API. The principal difficulty is to set our credentials in the code. With the v3 API, all the old login methods are "deprecated", to lead place to oAuth V2 login method.
In the API, i've didn't found a parameter where to set credentials. I hope you can find it. Let me know if this is the case.
If you success to create an httpClient object /w your credentials, this is perfect, the code is easy after doing this.
In the case you seach the right code for the v2 version : here
Good luck :)
I'm digging into this question now, too. So far, one workaround is to use the email upload option (found within Youtube's settings once logged in).
There's a limit of 25mb here so it's probably just a temporary proof of concept but powerful enough for smaller vids (mixed with FFMpeg tools wrapped for the language of your choice, I'm using Node.js http://www.benfarrell.com/2012/06/14/morph-your-media-with-node-js/)
Ideally, I want a user to upload a vid, store it in RAM, and then get it pushed to my youtube channel. We'll see what we find...

Resources