Premieres are a mix between a live stream and a traditional YouTube video. Detailed description: https://wersm.com/youtube-makes-premieres-available-to-everyone/
Is there any way for finding premieres of a channel through Youtube API?, is there any playlist, similar to autogenerated playlists of live broadcasts (https://www.youtube.com/channel/UC4R8DWoMoI7CAwX8_LjQHig), only with premieres?
YouTube search:list end-point (https://developers.google.com/youtube/v3/docs/search/list) doesn't include a event type filter for this kind of video. Only includes "upcoming" and "live" event filters, but they don't work with premieres. Only work with live content.
Thanks in advance.
Best regards.
The only way I have found is to:
Use the search endpoint with a channel id filter to build a list of all the videos in a channel that have liveBroadcastContent
set to upcoming
. This will get you a list of all the premiere videos, as well as the livestreaming ones.
Use the search endpoint with a channel id filter and an eventType
filter for upcoming
. This will get you a list of all livestreaming ones.
Take the difference of the two set of ids.
I just tested and it works for my channel, but I'll admit it's quite expensive in terms of quota consumption. It's not a great answer, but it's the only answer. :)
Alternatively, if it's possible to impose some restrictions on your content uploader, then I would suggest that you either ask them to 1) add their a hash tag in their video description or 2) add the video to a special, public but non-listed playlist. That way your application can either search for that hash tag or read from that playlist, the latter being much much cheaper for quota consumption.
Another way to do it:
Use the search endpoint with a channel id filter to build a list of all the videos in a channel that have liveBroadcastContent
set to upcoming
. This will get you a list of all the premiere videos, as well as the livestreaming ones.
Use the video endpoint with the list of ids that you have gathered from above, and be sure to put the contentDetails
as part of the part
parameter. You can see the duration of the video here. It will resemble something like this
"contentDetails": {
"duration": "P0D",
"dimension": "2d",
"definition": "sd",
"caption": "false",
"licensedContent": false,
"contentRating": {},
"projection": "rectangular"
},
This video is definitely an upcoming livestream, because it has a zero duration P0D
. The upcoming premieres already have a fixed non-zero duration.
That could work too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With