Share private video to some google accounts through API - google-api

I'm trying to figure out wheter it is possible to have a private video on youtube that I could share with particular Google Accounts through API.
I would have a separate web application that would have a Google signup and after signup I would enable that Google Account to watch my private video.
Ideally I would also want to embed the video to the web application (but I think I can do this rather easily if I'm an owner of the video).

Ispossible to have a private video on YouTube that I could share with particular google accounts through API.
No you cant directly share a video with another user like you could a file on google drive.
You could show the video on your own site, but I am not sure its something I would want to try. The thing is being that its a private video you and you alone have access to see it. Your going to have to authenticate your application and get a refresh token back which will allow you to access the account and the videos on the account.
Then you will be able to use that refresh token to get an access token to show other people the video via your website. The problem you will have is if the refresh token stops working (rarely happens but can happen) you will have to authenticate it again before your solution will work.
Note: Service accounts don't work with YouTube API. So don't bother going down that road.

If you know the ID of a video, you can access it. You can share the ID,or an embedded link with someone.
The api only hides the info, not blocks it. So you would need to hold the info elsewhere for referencing.
So as long as you know the id's of the related video's, you can do what you want with them.
However, if you are wanting to monetise them on the side, I would recommend against it. Best to read the user agreement you have with YouTube.

Related

Google OAuth Application Verification without Website

I am using the OAuth Functionality in a local Console Program to request the Videos for my Youtube Channel and upload Videos to Youtube.
For the Example which Google gives OAuth is used to authenticate to be able to retrieve the wanted data. But the Videos I am uploading keep getting put to private because my API Service is not verified.
Now I want to verify my API Service but I dont have a website for it so I can't provide any links for data security information or the main page of it. I mean it is a desktop app which only I am using and which is not meant to be publicly available.
How can I fulfill the verification process without any option to provide this informations?
private videos
If you check the top of the page for Videos: insert you will find that your videos are being uploaded private because your app has not been though a security audit.
app verification
In order to apply for app verification there are a number of urls that you need to supply
You will need to register a domain and claim it in web masters and then you will be able to add them.
If you want to be able to upload public videos via the YouTube Data api your app needs to be verified. In order to verify it you need to be able to show the TOS, privacy policy and the application home page. There is no way around this even if its a desktop app. Even if its single user you still need to do this.
I have a video which shows you what you need to know to verify your app.
What you need to know about Google verification in 2021.

Youtube private access management via API or library

I have a situation where I need to invite users to to be able to watch a private playlist on videos on Youtube.
I have found information about this at: Add or remove access to your YouTube channel
However that uses the user interface (Youtube page) and I'm looking for doing it in a programmatic way.
The best I found about managing channels is this: Implementation: Channels however there is nothing about invites and access removing.
Is there a way to invite users and and remove a user's permission using the YouTube API or a library?
Thanks.
No there is no way to add or remove permissions on channels though the YouTube Data api.
You might want to check though the issue log and see if anyone has already submitted a feature request for this. YouTube Issue forum.

Overly broad permission ask for google youtube API

I'm using the YouTube API to create a webpage that allows users to view a specific set of YouTube videos, and then LIKE those videos, using YouTube like/dislike rating system, and It's working fine, but when the user triggers the process, after logging into their google account, they are presented with a permission dialog that basically says
"Hey, this site wants complete and total control over your YouTube account!".
I DO NOT want that, I only want the user to be able to rate the videos.
I'm using the PHP Client library to pull the list of videos into the page and display them, and this requires no permissions or interaction from the user. I am also using the JS library to handle the "like" functionality, and it's basically the javascript example from https://developers.google.com/youtube/v3/docs/videos/rate?apix=true, but with my credentials.
Can I change this somewhere, or does YouTube just lump all of it's permissions under one giant "I can do anything" permission group?
I figured it out. It's about the OAuth 2 scopes, which the example lets you change for the DEMO, but it doesn't actually change the code in the sample.
For reference, the list of scopes is here: https://developers.google.com/identity/protocols/googlescopes#youtubev3

Lookup user's YouTube Account with Google Id

I need to locate the user's YouTube account/channel Google user Id.
A Google Search on find YouTube channel from google id yields several StackeOverflow possible options, some use the Google+ API which has been deprecated, but I'm sure there are alternatives using the Google Identity API or some other Google API.
Can anyone give me idea or a solution about how can I convert Google Account Id to YouTube Channel Id Account?
You need to remember that YouTube and google where originally two different companies there is probably no direct link that you are going to be able to hack your way to.
This is partly why (IMO) YouTube login is channel based. A user can have more then one channel so your not going to be able to find a single channel for a user relation its going to be a one to many relation. I dont think google has any way for you to see this without having the user login.
Your best option will be to ask the user to sign in and then use channels.list with the option mine.

YouTube v3 API PHP - Add Playlist Server to Server

All I want to do, with PHP and google-api-php-client, is create a new playlist and add it to my YouTube Channel server to server. All guides seem to require me manually clicking a link generated to authorize a token. What?!? With an API key shouldn't I just be able to do server to server changes/uploads/edits without any need of human interaction?
I enabled the API, created API Keys and OAuth ID/Secrets, but still can't figure out how to do it.
Any guide would be appreciated. Server to Server, with PHP, without me needing to open the file in a browser to allow access to account.
Thanks
Tried this: https://developers.google.com/youtube/v3/code_samples/php for adding a playlist and can't get it to work, even after clicking the link and allowing access to account.
You want to start learning something called OAuth. Don't worry, it's only sounds scary. I'll try and ease it a bit for you. But before I begin, no amount of loitering around avoiding that OAuth thing is going to get you anywhere. Good news is: it's not that twisted.
Imagine you were YouTube. An application, say a web application someone wrote that you didn't know about were to come to you making an HTTP request on you.
The request were to say, "Hey, YouTube chum! Can you add this bunch of erotica to John's playlist and just make it all public for everyone to see?"
What would be your response?
If I were YouTube, mine would be --
"Yeah! fook you, dude! Go ask John first! Then, show me some proof that you did."
"And wait a second, before you leave, I forgot to ask, who the fook are you, in fact? You got something to show me for who you are?" I, the YouTube, would add.
You see the problem? For YouTube, there are really two parties involved in this transaction:
The application that's making the sleazy request; and
Poor John, who probably knows nothing of all this even when he should.
Otherwise, what's to stop any application asking YouTube (or Facebook or Google or Github or any place else) for John's data?
So, as far as YouTube is concerned, it needs a way for the application to authenticate itself with YouTube (thus the Application Id and Client Secret or App Secret you created on the Google Developer Console), and it needs John's permission to let the said application do what it is asking you (YouTube) to do (thus the need for John to interact with a UI).
Enter OAuth.
OAuth is a document of rules that allows this co-operative transaction. But for it to work, all the three, YouTube, the web application, and John, must first conspire together.
There are three parties in OAuth:
The OAuth server -- that has John's data. In this example, it was YouTube.
The third-party application that wants to do something with John's data that's kept on the OAuth server, i.e. YouTube.
Poor John, a user on the OAuth server (YouTube), and also wanting to use the third-party Web application that wants YouTube to do something with John's data.
Now, there's a whole lot to learn about OAuth before you write a single line of code, and I can't write it all here but here's a YouTube playlist that starts by explaining the very basics of OAuth and then provides demos in (sorry, no PHP) C# and also in JavaScript.
Once you understand the OAuth transaction mechanism and see some code, then re-visit the YouTube API documentation page you linked to and it'll start to make an enormous amount of sense. It'll click and you won't need to look any place for help writing that example. It'll just come out of you like poop. :-)

Resources