Youtube v3 API comment retrieval with commentThreads.list endpoint - youtube

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.

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.

Is there a Youtube API endpoint to set sharing on a video within an organization?

I'm working on an app that uploads private videos to Youtube to be viewed by everyone at our organization. Luckily, Google and Youtube have an awesome company-wide permission for this, which allows for anyone with an email address within the company to view these videos.
Youtube has 3 options for video privacy status: Public, Unlisted and Private. I'd usually just go with Unlisted and call it a day, but due to the nature of these videos, I'd prefer for them to Private, then manually grant access to the video and share it with everyone at the organization. When done through the Youtube Video Manager page, here is the dialog box I'm looking for an API endpoint for:
Manual Approach
We can go through each video and check this box in each video, but that's not something that scales well. I'd love to find documentation on a Youtube API endpoint that handles this. There's a clear status.privacyStatus attribute for videos that can be set to private, public or unlisted, but nothing for this.
Does anyone know of a Youtube API andpoint to control this permission for private videos on Youtube?
I can back up the assumption from my comment that private video sharing is not possible through the Data API v3 with this article I found on the topic.
The author of the article even provides a workaround to this problem, although I strongly discourage using it, since it requires parsing sensitive account information (password) in PHP. Apart from that, the code is from 2010 and will most likely not work anymore because it is from before YouTube channels were linked to Google+ pages.

Storing YouTube metadata

I've read YouTube's Terms of Service several times and have Googled this question tirelessly with no concrete answer. This is not a legal question about my specific YouTube API client, I just want to know if any YouTube developer has used the API in this way. I'm working on a side project for myself that's essentially an Instagram-YouTube mashup. I am a YouTube developer with an API key. Can my API client store a videos title, description and id in my database when my users like a video on my client? I don't know how else I can keep track of my users liked videos within my client.
Since you already specified that this is in fact not a legal question, the short answer is: Yes, you can (meaning it is possible).
There is one more possibility coming to mind, though:
You could authenticate users via OAuth 2.0 using the https://www.googleapis.com/auth/youtube scope. That way, you can manage their liked videos and add/remove videos to this list when a user clicks the according buttons on your website (you can also check if any given video is already liked by the user). In this case, all the track-keeping is done by YouTube itself. This ultimately means that whenever a user likes a video in your app, they also like it on the YouTube website. This may or may not be desired, it is for you to decide that.

How to get user specific recommended videos based on specific channel

How to get user specific recommended videos based on specific channel like - nba, nationalgeographic using YouTube API?
I am using the below API to get recommended videos.
https://gdata.youtube.com/feeds/api/users/default/recommendations?v=2&key=&access_token=
key -> I am passing my developer key
access_token -> I am passing authentication token.
Its returning me recommended videos of specific user. But I need recommended videos of specific channels like nba, nationalgeographic.
Can anyone please help for this.
I know this is old but in case anyone googling this comes across this answer, a workaround until there is a full recommendation API in YouTube API v3 is to use the Activity List feature, then just go through the results looking for "type": "recommendation":
https://developers.google.com/youtube/v3/docs/activities/list
GET https://www.googleapis.com/youtube/v3/activities?part=snippet&home=true&maxResults=50&key={YOUR_API_KEY}
(don't forget to use an auth token for a user for this to work)

How to get Read-only Youtube API access

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

Resources