Allowing user to upload to their own channel using youtube api - youtube-api

Youtube's api ToS state that we must allow a user to upload a video to their own account or to our youtube application account. What would be the proper process for doing this? The code snippets refer to using one's own account (e.g. api key and secret key). Will these work for uploading to the user's account?

Well, if you want users to upload video on your channel, what they need is your OAuth token. This SO question also have an information about your problem.
This documentation will explain you on how to obtain an OAuth access token. It contains sample code that you can copy/follow.
For more information, you can check these tutorials:
How to Authenticate & upload videos to YouTube Channel in PHP
PHP server-side YouTube V3 OAuth API video upload guide

Related

Google YouTube Data v3 API Blocked From Uploading Videos

Recently I have been using multiple scripts that allow you to upload a video via the YouTube Data v3 API from GCP.
However, the videos always gets auto privated and locked. I have done research and found out it's because you need verification on your API key or whatever.
Does anyone know how to get the API key verified or to be able to use the API to upload videos without it being auto locked to private?
Does anyone know how to get the API key verified or to be able to use the API to upload videos without it being auto locked to private?
To be clear api keys are used to access private user data. To upload videos to YouTube you need to use Oauth2 and be authorized to access a users YouTube account
However, the videos always gets auto privated and locked.
If you check the documentation for Videos: insert you will find the source of your issue and what you need to do to fix it.
All videos uploaded via the videos.insert endpoint from unverified API projects created after 28 July 2020 will be restricted to private viewing mode. To lift this restriction, each API project must undergo an audit to verify compliance with the Terms of Service. Please see the API Revision History for more details.
Go though the verification process and then you will be able to upload public videos.
Unverified apps
What you need to know about Google verification

YouTube Data API: Choosing the destination YT channel when uploading my video

I've followed the steps explained here: https://developers.google.com/youtube/v3/guides/uploading_a_video in order to use their script to upload a video on my channel.
The problem is that my GMail account is associated to two YouTube channels: my personal one which is its default YT channel, and a new one that I've created this morning. The latter is the good destination channel for my videos.
How can I tell the YouTube Data API to upload the video to this channel and not the default one? I didn't see anything useful in the Console API "YouTube Data API", nore in the technical documentation of the upload script (given above).
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.

YouTube API to upload to Business Channel

Is there any way of using the YouTube API so that users can upload videos directly to my business YouTube channel? Users would grant permission to upload to my channel on the website. I want to avoid uploading to another server, then to YouTube if possible.
Thanks
You can use service account OAuth2 to authorize requests from your app on your behalf to a channel that your account is authorized to access/the owner of.
Create service account credentials: (documentation here)
and make sure the YouTube Data API v3 is enabled on your API
project (getting started guide here, if you're new to the API).
Use your service account OAuth credentials to call the upload API: (documentation here) use the auth in step 1 to upload the video your users share with you and specify your business YouTube channel ID in the video resource. Sample code in various languages here (just search for upload examples after you choose your preferred language).
Things to keep in mind:
If you enable uploads to your channel by end users but don't do any checking/validation there is potential for abuse
service account OAuth is valid for 1 year, so you'd need to refresh the service account credentials every year
It will look like these videos are being uploaded by your business channel and not other user's channels (because that's what's happening via the API).

Get YouTube playlist videos anonymously

I would like to display a list of videos from a YouTube playlist in an intranet application.
Is it possible to get the list of videos from a YouTube playlist using the Data api (or any other way) without requiring the user to login?
Everything that I have read so far in the YouTube data api requires the user to be signed in to authenticate.
unfortunately, you can't access youtube data API with anonymously user.
Your application must have authorization credentials to be able to use the YouTube Data API.
The Developers Console associates your credentials with the APIs that you indicate that your application will use. Note that the Developers Console does not allow you to select the YouTube Data API (v2). However, authorization credentials for the v3 API will also work for the v2 API.
If possible, you should actually use YouTube Data API (v3) rather than the v2 API in your application. The YouTube API blog explains some of the benefits that the newer API offers, and we have added a year's worth of additional functionality to the API since that blog post!
related link : https://developers.google.com/youtube/2.0/developers_guide_protocol_oauth2#OAuth2_Client_Side_Web_Applications_Flow

YouTube video upload API

I have completed uploading videos to YouTube from my website, that's for particular user account only (means all videos uploaded to single user account). Now I want that user come to my site enter their YouTube username and password and selected video will be upload to their account.
Till now what i have done is i have uploaded videos to my own account with my developer key. But now i want that if any user uploads video to YouTube then it uploads to his/her account. I am not able to find out the way because it may possible that they don't have developer key which is required to upload. So i need help in this.
I have seen API but I am not able to work out help for this. Anyone can help me in this?
Thanks!
You need to use the OAuth 2.0 API documented here: https://developers.google.com/youtube/2.0/developers_guide_protocol_oauth2 to obtain the credentials you need.
Using the credentials you create a link to Google's authorization service which your customers follow. On that page they can either allow, or deny, access to their YouTube account to your service. Assuming permission is granted, the service will redirect to the "callback" location URL you provided along with a pair of access tokens. You can then use these tokens to upload videos to YouTube and the videos will appear in the customer's account as they they had uploaded them.
It would be helpful if you could be more specific about what you are asking.
This is the youtube API for uploading videos:
http://code.google.com/apis/youtube/2.0/developers_guide_protocol_uploading_videos.html

Resources