many streams on the list = doesn't show any results
-
I had this issue when i used the plugin on a different website as well in the past:
The problem occurs when your list of streams is getting big, then on the website it doesn’t show any live streams (texts). When you remove a couple of streams from the list, everything comes back to normal.
When i didn’t use the plugin my brother built me a script to bypass the issues. Please see it below and use anything that can help to fix the issue. especialy check the first var lines, as i think that might be the issue that the pluging reaches one of the tresholds that my brother below stated manually and any time querry reches the treshold the script starts a new querry (with list of streams). because with many livestreams to check, due to below 3 tresholds it’s impossible to send a querry to twitch in 1 querry. you need to start splitting it if it makes sense. the script below does it.
Please help.
<p><script>
var ieMaxUrlLength = 2083;
var jQueryJsonPSuffixLength = 70; // Roughly
var maxTwitchResults = 100;$(document).ready(function($) {
var channelIds = $(‘.ltwitch’).map(function () {
return $(this).data(‘tnick’);
}).toArray();
var baseUrl = “https://api.twitch.tv/kraken/streams/?limit=”+maxTwitchResults+”&channel=”; // see https://github.com/justintv/Twitch-API/blob/master/v2_resources/streams.md
var resultsCount = 0;
var url = baseUrl;
for (var i = channelIds.length-1; i >= 0; –i){
var channelId = channelIds[i];
url += channelId + ‘,’;
if (i === 0 || (++resultsCount == maxTwitchResults) || url.length + channelIds[i-1].length > ieMaxUrlLength – jQueryJsonPSuffixLength) {
$.getJSON(url + “&callback=?”, function (streamsResult) {
$.each(streamsResult.streams, function (idx, stream) {
var $player = $(“[data-tnick]”).filter(function () { return this.getAttribute(‘data-tnick’).toLowerCase() === stream.channel.name.toLowerCase(); });
$player.next().html(“Online”);
$player.parent(‘div’).css({display: “block”});
});
});
url = baseUrl;
resultsCount = 0;
}
}});
</script></p>
- The topic ‘many streams on the list = doesn't show any results’ is closed to new replies.