Google YouTube API Create Channel https://developers.google.com/youtube/create-channel
Step 4) Your application monitors the WebView to determine when its location changes to the following URL, which indicates that the user's Google Account has been linked to a YouTube channel.
How would I monitor this with Javascript or Angular? Is there any callback I can do to close that window, return to my web application and refresh the page? Thanks.
Related
We're working on an integration with youtube channels (using Youtube Data Api v3). We need to access the videos (private also) on our user's channels.
The flow is the following:
User authorizes his/her youtube account on our site using OAuth.
We show user the list of videos on user's youtube channel.
User selects some of them (they can be private) and sends us for processing.
We need to somehow access the actual video files which the user asks us to process.
The issue is that youtube does not give any streaming URLs or download links.
Looks like, the API provides only iframe embedded code, which works ONLY for the browser, where the user is actually logged into youtube.
How can we access(can we?!) the private video, if we have the OAuth access-token of the video owner?
The YouTube Data API lets you incorporate functions normally executed on the YouTube website into your own website or application. The lists below identify the different types of resources that you can retrieve using the API. The API also supports methods to insert, update, or delete many of these resources. This in a sense means that you can see most of what you can see on the YouTube website including uploading new videos.
Downloading Youtube videos is against their Terms of Service, so the API does not support that.
Page linked above refers to Youtube ToS that states:
You shall not download any Content unless you see a “download” or similar link displayed by YouTube on the Service for that Content.
YouTube partners may have access to this feature in their API (no idea i have never seen the api), if you have access to this i suggest you contact your manager directly they should be able to instruct you on how to access it assuming the feature exists.
I would like to load the livestream into my live list when the status is live without using the access key.
No, it is not possible.
You need a Google Account to access the Google Developers Console, request an API key, and register your application.
Register your application with Google so that it can submit API requests.
After registering your application, select the YouTube Data API as one of the services that your application uses:
Go to the Developers Console and select the project that you just registered.
Open the API Library in the Google Developers Console. If prompted, select a project or create a new one. In the list of APIs, make sure the status is ON for the YouTube Data API v3 and, if you are a YouTube Content Partner, the YouTube Content ID API.
Source
I am making a web app where user can view video. That video I will upload in youtube. When the user is registered in my web app, he can then view the video I have uploaded or the video in my channel.
Is it possible to do this?? I want to upload videos in my youtube channel and allow only the user from my web app to view the video.
Any suggestion ??
I think what you need here is OAuth. Here are the concepts of using OAuth.
When a user first attempts to use functionality in your application that requires the user to be logged in to a Google Account or YouTube account, your application initiates the OAuth 2.0 authorization process.
Your application directs the user to Google's authorization server. The link to that page specifies the scope of access that your application is requesting for the user's account. The scope specifies the resources that your application can retrieve, insert, update, or delete when acting as the authenticated user.
If the user consents to authorize your application to access those resources, Google returns a token to your application. Depending on your application's type, it either validates the token or exchanges it for a different type of token.
If it is just a simple video, then you can try to set the privacy settings of your video. You can either set it as public, unlisted and private. It will return in the status.privacyStatus.
If you want to know on how to set it in your code, you can follow this sample code.
For more information, you can also check this SO question.
I want to make a web application and I want to use YouTube API to allow my users make live broadcasts.
Is it necessary that my users log with their Google/YouTube accounts to use the live stream or is it possible to make them use this function without bothering them with this detail?
In order to create the Live Event and Live Stream objects required for a livestream on YouTube, the user making those requests must be authenticated.
From the Docs:
Your application must have authorization credentials to be able to use the YouTube Live Streaming API.
Obtaining authorization credentials guide here.
Adding a live event is similar to uploading a video. The user making the upload must be authenticated in order for the video to appear on their channel.
The goal of my YouTube API call is, given a channelId, to return whether that channel is currently live streaming. This is the call I'm making currently:
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId={CHANNEL_ID}&eventType=live&type=video&key={YOUR_API_KEY}
While this call is functional, there is a significant delay between the channel starting a live stream and this call returning the stream.
Is there a better call to use in the YouTube v3 API that doesn't require oAuth? The functionality of my app is read-only.
Thanks!
Probably late but still someone else would use it, i found the answer on google api docs:
https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/list
(Scroll to bottom, you can use their onsite api to make calls on the fly)
The call you have to make is:
GET https://www.googleapis.com/youtube/v3/liveBroadcasts?part=id%2Csnippet%2Cstatus&mine=true&broadcastStatus=active&key={YOUR_API_KEY}
(atm, they have an issue wth the status field). You can remove the filter and check the returned results for
{ "status": { "lifeCycleStatus": "live"}}
And as per google docs:
Before you start
You need a Google Account to access the Google Developers Console, request an >API key, and register your application.
Register your application with Google so that it can submit API requests.
After registering your application, select the YouTube Data API as one of the >services that your application uses:
Go to the Developers Console and select the project that you just registered.
Open the API Library in the Google Developers Console. If prompted, select a >project or create a new one. In the list of APIs, make sure the status is ON for >the YouTube Data API v3 and, if you are a YouTube Content Partner, the YouTube >Content ID API.
Calling the Data API
The API request must be authorized by the Google Account that owns the >broadcasting YouTube channel.
You can check this link for generating an access(OAuth 2.0) token: https://developers.google.com/identity/protocols/OAuth2?hl=en
I hope this helps.
I was digging for a "cheaper" way to find if a channel is live to save some API quota. I attempted to use Konstantin's workaround by looking at the {channel/channel_id}/live but this appears to not work anymore.
The channel no longer redirects when a person is live. Instead it runs on that page.
If they have a username URL then /c/ works: https://www.youtube.com/c/USER_NAME/live
If they have don't have a username and use the default like UC4R8DWoMoI7CAwX8_LjQHig, then you need to use https://www.youtube.com/channel/USER_NAME/live
The /search call is rather expensive. If you are only allotted the initial 10k quota points, you'd run out of points after only 100 queries. That may not be a bother for some use cases, but it is nevertheless limited.
Instead, you can use Playwright and do the following:
page.goto("https://YouTube.com/channel/{channel id}/live")
Then check for a redirection which will happen when the channel is live:
const redirect = page.url()
If redirect contains a link to a YouTube video, then you know the channel is live. Otherwise it is not live and will yield a link similar to the one that's passed in to the goto() function.