Finding premieres through Youtube API
Asked Answered
M

1

6

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.

Morganstein answered 22/12, 2019 at 15:45 Comment(3)
Can you edit your question and describe what have you tried and what do you (or YouTube) consider "premiere videos"? - what is your criteria for get such videos?Staceestacey
Premieres are a mix between a live stream and a traditional YouTube video. Description -> wersm.com/youtube-makes-premieres-available-to-everyoneThetes
Alberto, press the edit link and add relevant information in your question. Please read how to make a good question. Right now, it's not really a good question. See: https://stackoverflow.com/help/how-to-ask.Staceestacey
S
1

The only way I have found is to:

  1. 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.

  2. 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.

  3. 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.

UPDATE

Another way to do it:

  1. 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.

  2. 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.

  1. Keep any videos that have a non zero duration.

That could work too.

Strenta answered 13/9, 2020 at 20:41 Comment(1)
I also see, @Alistair, that premieres have status.uploadStatus set to processed as opposed to upcoming live streams having that property set to uploaded.Purvis

© 2022 - 2024 — McMap. All rights reserved.