The Broadcasts created via Youtube LiveStreaming API are default optimized for lower buffering. But on the main Youtube GUI, a new option has been introduced called "optimized for lower latency".
Any way we could access this using the API? Also, what would be the approximate delta change in latency? Would be great to access this via the Youtube APIs.
When creating a liveBroadcast, set enableLowLatency to true in the contentDetails object
Don't forget to include contentDetails in the part parameter to tell youtube that you want the contentDetails parameter persisted.
From non scientific observations on a couple of broadcasts so far, this setting seems to lower the latency from ~30s to ~15s
Related
I am trying to get all videos for August using the channel ID, but there were 3 videos that don't reflect on the data returned by the API.
The data returned to me started in July 16th, but there were videos in later July and two in August.
I'm using Python to request and parse the returned data.
Here is the channel where it happened to not scrape the video well but works in other channel: UCT4ayiqWW9qOqOq_u8trQTg. The API url:
https://www.googleapis.com/youtube/v3/search?key=...&channelId=UCT4ayiqWW9qOqOq_u8trQTg&part=snippet,id&order=date&maxResults=20.
I can provide the returned data if needed.
I can confirm that the Search.list API endpoint, as invoked above, does not return the newest (at the time of this writing) three entries of the channel:
I8TcAA-ri3M 2021-08-12T22:47:25Z ¡LA BUILD MASTER QUE HACE DE GAREN UN CAMPEÓN IMPARABLE! GAREN WILD RIFT
ZDJJ7TWkpk8 2021-08-11T18:30:24Z ¡EL MEJOR CAMPEÓN PARA GANAR EN WILD RIFT! ¡HA VUELTO LA BESTIA AKALI!
BdKWNMvtrxc 2021-07-22T20:30:00Z KATARINA vs AKALI ¿CUAL ES MEJOR PARA GANAR EN WILD RIFT? ROAD TO MAESTRO S2
This may be considered a bug (and, therefore, reported as such to Google, through it own issue tracker site). But you have to also consider that Search.list has a well-known fuzzy (that is imprecise) way of functioning.
I recommend that you follow a different path for to alleviate this undesired behavior of the API: How to avoid omissions in video information acquisition when using the YouTube Data API?
That answer of mine details an alternate well-known method of querying a channel specified by its ID for its newest uploads. See also the second section -- For the uploads playlist of a channel, the items returned by PlaylistItems.list API endpoint are (have to be) ordered in reverse chronological order by contentDetails.videoPublishedAt -- of this other answer of mine: YouTube Playlist Item API publishedAt field clarification.
Also important to note is that using this procedure is significantly less expensive in terms of quota costs. The Search.list API endpoint is quite expensive: 100 units of quota per call of it; the PlaylistItems.list API endpoint (used by the alternate method) is very cheap: 1 unit of quota per call.
I need to get the current live streams for a list of channelIds. After a lot of research it looks like the only solution is to use the search endpoint, specifying the channelId. This solution will not work because the very high unit cost (100 units per channel in the list). Additionally, I would be polling the live streams for this channel list every 5 minutes or so. This would be far too costly to work.
Potential Solutions:
1) Push Notifications API
https://developers.google.com/youtube/v3/guides/push_notifications
If this API could also send notifications for when a channel starts a live stream, this would completely solve my problem
2) Activities Endpoint
https://developers.google.com/youtube/v3/docs/activities/list
If this endpoint would also include livestream activity, I could use this since the cost would only be 1 unit per channel, which could work.
3) Search Endpoint
https://developers.google.com/youtube/v3/docs/search/list
If this endpoint could accept multiple channelIds, I could use a few search calls to get all of the channels, which might also work.
Are there any other ways to solve this problem? It seems like a pretty valid use case for the Youtube API to be able to get live streams for a channel without the extraordinary cost per channel.
I am trying to fetch metrics like views, likes, dislikes for videos in some popular public Youtube channels and also subscription information of the Channelsa on a daily basis. Also, country wise stats and gender wise stats for the channels required. But, Youtube Reporting API always prompts authentication. Is there any way to fetch those metrics for public Youtube channels without user authentication?(https://www.googleapis.com/youtube/analytics/v1/reports - need to use this API). Your suggestions will be very helpful.
For some of read-only requests you can just use access token without need to authorize. Check the documentation. Each request's documentation tells if authorization is needed.
The API you linked to is part of the "YouTube Analytics and Reporting APIs", which is split up in these very two pieces - analytics and reporting. I don't see why you need to use this exact API, but I can tell you that you won't succeed with it. This API is intended for channel owners and network owners to get information about their own channels. You absolutely have to authenticate via OAuth in order to use it, there is no way around this.
In order to get video and channel metrics, you can consult the YouTube Data API. Here, an API key from the Google Cloud Console will let you fetch any public data without further authentication. But it will not provide you with data records in specific periods of time, it always returns the current values of the requested properties.
In other words: what you are asking is, as far as I know, impossible to achieve with any official YouTube API.
A workaround for your problem would be to fetch the desired properties via the Data API on a, say, daily basis and compare their values to the previous day's values and calculate the delta.
I have created a new google account, then I have enabled youtube live streaming and started to stream. I have app key and access token for my user, but http get request to https://www.googleapis.com/youtube/v3/liveStreams?part=snippet&access_token=MY_TOKEN&key=MY_KEY&mine=true is returning zero results, meanwhile at the moment I have live stream.
What to do?
Try using LiveStreams.list instead. It returns a list of video streams that match the API request parameters. There's an example for your code reference.
I found the saving clue in this SO answer. To receive the list, one has to explicitly provide the broadcastType parameter to the query.
Acceptable values are:
all – Return all broadcasts.
event – Return only scheduled event broadcasts.
persistent – Return only persistent broadcasts.
If you find this answer useful, please make sure to upvote the linked answer (as well). I just copy-pasted this.
My company runs a live web stream and has started duplicating this to YouTube. Unfortunately the staff won't check if it's live and internet issues cause our web encoder to stop encoding at times.
Is there a programmatic way I can tell if a channel is ACTUALLY streaming? i.e. if live video is coming out the channel and not just that "the channel is live"?
You may use Search: list.
Using this request returns a collection of search results that match the query parameters that you have specified in the API request. Add part=snippet in your request since this is a required parameter. Then, you may add the following optional parameters with their corresponding values in your HTTP request:
channelId=[channelId] - to search resources created by a particular channel.
type=video - to retrieve a particular type of resource
eventType=live - to return only active broadcasts. Please note that if you use eventType, also set the type parameter's value to video.
Combining all of these parameters, you may send HTTP request using the following format:
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCXswCcAMb5bvEUIDEzXFGYg&type=video&eventType=live
To better filter your search, you may also opt to add more parameters that are listed in supported parameters.
Lastly, solution in this related SO post - How to check if YouTube channel is streaming live might also help.