# Retrieve Most Popular Videos On Particular channel via API call

**URL:** <https://discuss.dev.twitch.com/t/retrieve-most-popular-videos-on-particular-channel-via-api-call/6161>\
**Category:** API\
**Created:** [May 16, 2016, 5:20pm UTC](https://discuss.dev.twitch.com/t/retrieve-most-popular-videos-on-particular-channel-via-api-call/6161 "2016-05-16T17:20:35Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaypandya29](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@jaypandya29](https://discuss.dev.twitch.com/u/jaypandya29)\
**Post date:** [May 16, 2016, 5:20pm UTC](https://discuss.dev.twitch.com/t/retrieve-most-popular-videos-on-particular-channel-via-api-call/6161/1 "2016-05-16T17:20:35Z")

</div>

Can anyone tell me how to get most popular videos on particular channel via an API call?

i have this call GET /channels/:channel/videos to get videos of that channel and want most popular among it.

---

<div class="post-metadata">

**Author:** ![DallasNChains](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/dallasnchains/32/1608_2.png) [@DallasNChains](https://discuss.dev.twitch.com/u/DallasNChains)\
**Post date:** [May 16, 2016, 5:38pm UTC](https://discuss.dev.twitch.com/t/retrieve-most-popular-videos-on-particular-channel-via-api-call/6161/2 "2016-05-16T17:38:10Z")

</div>

There is an API for videos here: [https://github.com/justintv/Twitch-API/blob/master/v3\_resources/videos.md](https://github.com/justintv/Twitch-API/blob/master/v3_resources/videos.md) You would use the /top/ endpoint for the most popular videos.

---

<div class="post-metadata">

**Author:** ![jaypandya29](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@jaypandya29](https://discuss.dev.twitch.com/u/jaypandya29)\
**Post date:** [May 16, 2016, 5:44pm UTC](https://discuss.dev.twitch.com/t/retrieve-most-popular-videos-on-particular-channel-via-api-call/6161/3 "2016-05-16T17:44:34Z")

</div>

@DallasNChains - Thanks…but didn’t help I have seen that documentation for TOP videos and it just gives me general results about latest created and viewed but as i mentioned i want TOP videos for particular channel and yeah put /top/ endpoint also didn’t work for existing another API call.

---

<div class="post-metadata">

**Author:** ![DallasNChains](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/dallasnchains/32/1608_2.png) [@DallasNChains](https://discuss.dev.twitch.com/u/DallasNChains)\
**Post date:** [May 16, 2016, 6:06pm UTC](https://discuss.dev.twitch.com/t/retrieve-most-popular-videos-on-particular-channel-via-api-call/6161/4 "2016-05-16T18:06:08Z")

</div>

Ah! There isn’t an API that will give you a ranked list directly. You would have to call the [channel videos API](https://github.com/justintv/Twitch-API/blob/master/v3_resources/videos.md#get-channelschannelvideos) and rank those by the `views` field that you get in the response.

---

<div class="post-metadata">

**Author:** ![jaypandya29](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@jaypandya29](https://discuss.dev.twitch.com/u/jaypandya29)\
**Post date:** [May 16, 2016, 6:10pm UTC](https://discuss.dev.twitch.com/t/retrieve-most-popular-videos-on-particular-channel-via-api-call/6161/5 "2016-05-16T18:10:28Z")

</div>

@DallasNChains - Done that already sorting via views worked but only for smaller number of videos say there would be 300 videos then i have to make API call and these calls give results in limit of 10 and offset of 10 i would have to make so many call to check if there is next link then get views of videos and after all these operations it takes much time for my application.

Is there any way to get views of all videos of channel disregard of offset and limit in API call? Please suggest!!

---

<div class="post-metadata">

**Author:** ![DallasNChains](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/dallasnchains/32/1608_2.png) [@DallasNChains](https://discuss.dev.twitch.com/u/DallasNChains)\
**Post date:** [May 16, 2016, 6:14pm UTC](https://discuss.dev.twitch.com/t/retrieve-most-popular-videos-on-particular-channel-via-api-call/6161/6 "2016-05-16T18:14:38Z")

</div>

@jaypandya29 You can’t disregard the limit and offset. The default limit is 10, but you’re free to set the limit up to 100. If you look at the parameters in the documentation, you will see that it says maximum of 100 for the limit. Hope that helps! 😄

---

<div class="post-metadata">

**Author:** ![jaypandya29](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@jaypandya29](https://discuss.dev.twitch.com/u/jaypandya29)\
**Post date:** [May 16, 2016, 6:17pm UTC](https://discuss.dev.twitch.com/t/retrieve-most-popular-videos-on-particular-channel-via-api-call/6161/7 "2016-05-16T18:17:02Z")

</div>

@DallasNChains - Yeah i have seen that i kept that as my last option as of now till i found something which i can replace. Just afraid that what if that limit = 100 would not fill proper requirement for most popular video for channel.(Plus application performace affects for limit 100)  
i really appreciate your help! Thanks!!!

---

<div class="post-metadata">

**Author:** ![DallasNChains](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/dallasnchains/32/1608_2.png) [@DallasNChains](https://discuss.dev.twitch.com/u/DallasNChains)\
**Post date:** [May 16, 2016, 6:35pm UTC](https://discuss.dev.twitch.com/t/retrieve-most-popular-videos-on-particular-channel-via-api-call/6161/8 "2016-05-16T18:35:40Z")

</div>

@jaypandya29 Just FYI, the API calls include the `next` attribute in the `_links` object. This will give you the next URL to request for the next 100 results for the channel. Makes it super easy to page through all the videos for that channel. 🙂

---

<div class="post-metadata">

**Author:** ![jaypandya29](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@jaypandya29](https://discuss.dev.twitch.com/u/jaypandya29)\
**Post date:** [May 16, 2016, 6:41pm UTC](https://discuss.dev.twitch.com/t/retrieve-most-popular-videos-on-particular-channel-via-api-call/6161/9 "2016-05-16T18:41:52Z")

</div>

@DallasNChains- Yes i do know that but its not very good for coding to go through so many pages via call it totally get affect to application and hope you know that i posted here for the alternate solution which i don’t know about twitch.  
Go through next 100 pages and pick `views` and then compare to previous one and do all these till total videos Does this really seems to a proper solution?

---

<div class="post-metadata">

**Author:** ![DallasNChains](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/dallasnchains/32/1608_2.png) [@DallasNChains](https://discuss.dev.twitch.com/u/DallasNChains)\
**Post date:** [May 16, 2016, 6:59pm UTC](https://discuss.dev.twitch.com/t/retrieve-most-popular-videos-on-particular-channel-via-api-call/6161/10 "2016-05-16T18:59:39Z")

</div>

@jaypandya29 I wouldn’t suggest trying to rank in realtime. That’s definitely going to be slow. 🙂 If I were implementing this, I would have a backend service that calls the Twitch API and caches the `views` data. That would be where I get data for my UI rendering. The `views` data in my cache would be updated either a) on-demand when someone accesses a given channel or b) nightly. It all depends on your use case!

---

<div class="post-metadata">

**Author:** ![jaypandya29](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@jaypandya29](https://discuss.dev.twitch.com/u/jaypandya29)\
**Post date:** [May 16, 2016, 7:03pm UTC](https://discuss.dev.twitch.com/t/retrieve-most-popular-videos-on-particular-channel-via-api-call/6161/11 "2016-05-16T19:03:39Z")

</div>

@DallasNChains - Ahhh, Thanks for your suggestion. I would look forward to it. 😄

---

<div class="post-metadata">

**Author:** ![jaypandya29](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@jaypandya29](https://discuss.dev.twitch.com/u/jaypandya29)\
**Post date:** [May 17, 2016, 4:38pm UTC](https://discuss.dev.twitch.com/t/retrieve-most-popular-videos-on-particular-channel-via-api-call/6161/12 "2016-05-17T16:38:44Z")

</div>

@DallasNChains - Just to ask result from call GET /channels/:channel/videos i analyzed this and want to make sure that result will be based on most recent creation on videos? what’s your view on this?

---

<div class="post-metadata">

**Author:** ![DallasNChains](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/dallasnchains/32/1608_2.png) [@DallasNChains](https://discuss.dev.twitch.com/u/DallasNChains)\
**Post date:** [May 17, 2016, 7:16pm UTC](https://discuss.dev.twitch.com/t/retrieve-most-popular-videos-on-particular-channel-via-api-call/6161/13 "2016-05-17T19:16:24Z")

</div>

@jaypandya29 That’s correct. It is sorted by most recent.

---

<div class="post-metadata">

**Author:** ![jaypandya29](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@jaypandya29](https://discuss.dev.twitch.com/u/jaypandya29)\
**Post date:** [May 18, 2016, 4:00am UTC](https://discuss.dev.twitch.com/t/retrieve-most-popular-videos-on-particular-channel-via-api-call/6161/14 "2016-05-18T04:00:25Z")

</div>

@DallasNChains - Thanks… 😀

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [June 17, 2016, 4:00am UTC](https://discuss.dev.twitch.com/t/retrieve-most-popular-videos-on-particular-channel-via-api-call/6161/15 "2016-06-17T04:00:39Z")

</div>

Closed on June 17, 2016, 4:00am UTC

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