jp1995 / kappa-launcher

Twitch launcher using Rofi
MIT License
27 stars 4 forks source link

Increase number of streams gathered from API call #5

Closed the1ts closed 4 years ago

the1ts commented 4 years ago
jp1995 commented 4 years ago

What does the offset parameter do exactly? Does it not work if those parameters are appended to the existing API call? Can't check for myself atm.

the1ts commented 4 years ago

Offset allows you to start getting streams at that number. The default offset starts at 0 so for these two calls, 0-99 in the first call, 100-199 in the next. In short offset allows you to walk across the full number of streams (up to 1000).

Limit is the number returned in that call, the default is only 25, so if you follow more than 25 current streams you will not have all of them listed currently, this is how I noticed the issue. A chrome plugin was notifying of new streams and kappa-launcher was not showing them.

Also, the jq call works fine with 2 concatenated json objects. I've done the test using limits and offsets in the small range to return 2 valid json objects and get a full listing of streams from jq. It also works when there is a full json object and an empty one as most people will get now we return a max of 200 streams. Not sure there is a way to get the total number of followed streams that are live so just took a decision to check for 200 streams for now.

jp1995 commented 4 years ago

I see. I agree that 25 is way too low. That said, 200 sounds a bit excessive but as long as it works without any issues with the API it's fine.