Aggregate stream duration and peak viewership stats for all channels within a Team

Hi guys, let’s say there are 20 channels that are part of a Twitch team and they have all given stats access to the team as well. Can someone explain what the best approach is to start curating stats like stream duration, peak viewership, and possibly advertisement breaks/runtime on a per channel per stream basis? From reading other posts and experience with the API, I know that I would have to curate the data and store the data in a database myself to build a historical dataset over time, but I wanted your opinions on how to do this for channels that are part of a team. I have access to the Team twitch login, of course.

Thanks!

Use

To get who is in the team

Call the

With up to 100 user_id’s

There is no documented way to do this one.

1 Like

Thanks for your reply! Do you know if it is possible to only retrieve info for videos that were past broadcasts? The type in the “Get Videos” endpoint doesn’t clarify this for me here unless type = “archive” is the same as past broadcasts.

The reason I need to use get-videos instead of get-streams for a given userid is because I need to see duration data for the past streams-- live streams are a little less important for my metrics. However, even if I use get-videos, I’m not sure how to get the average concurrent viewers or peak viewers during that past broadcast since there is no response variable related to that.

Thus, I am curious what the best way to accomplish the following would be:

  1. Grab all channels for a given team (done, use get team endpoint)
  2. For each user id in the team above, find stream duration, avg. concurrent viewers and peak viewers for all past broadcasts (need help with this one)
  3. Also find # Ad breaks and total ad duration per past broadcast (impossible using the API as you already mentioned)

https://api.twitch.tv/helix/videos?user_id=USERID&type=archive

you can also use webhooks to collect in real time

  • Stream Duration

For up/down notifications

Poll the streams endpoint once per minute and math the results

1 Like

Thanks, I’ll check out the Webhooks guide for new streams moving forward. If I wanted to backfill historical data from past broadcasts, is there a way to retrieve peak viewers or any viewer data that we can calculate over for past broadcasts (video type ‘archive’)?

Nope

Theres no historical data endpoints like that

1 Like

Thanks for all your help, it is much appreciated!

Last couple questions to help me get started with using the Twitch API.

  • Even if videos are privated, I should be able access the data returned from the get-videos endpoint right? If not, how can I utilize the fact that the channels/user ids I am retrieving videos for are team members of the parent Twitch login that I do have access to (OAuth authorization?)
  • Do you have any pointers/references of using Python to create and parse requests/responses from the new Twitch API?

Just use whatever the equivalent is to make API calls.

Or seek out an existing helper library I don’t touch python often so I don’t have any suggestions.

I believe they still show in the Videos API yes. Assuming by “privated” you mean “sub only vods”

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.