From 074e60dfb020245e1ae6148b22d1faeaae6dd965 Mon Sep 17 00:00:00 2001 From: Joe Rayhawk Date: Sat, 13 Aug 2016 23:22:17 -0700 Subject: lstwitch: fix offset problems --- lstwitch.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lstwitch.rb') diff --git a/lstwitch.rb b/lstwitch.rb index be71fc0..cf8af46 100755 --- a/lstwitch.rb +++ b/lstwitch.rb @@ -27,10 +27,10 @@ end while offset < total - response = JSON.parse(http.request(Net::HTTP::Get.new("/kraken/streams/?offset=#{offset}#{game}")).body) + response = JSON.parse(http.request(Net::HTTP::Get.new("/kraken/streams/?limit=100&offset=#{offset}#{game}")).body) total = response["_total"] for stream in response['streams'] - printf( "%-45s %-36s %6i %6i %-.#{width-46-37-7-7}s\n", stream['channel']['url'].to_s, stream['channel']['game'].to_s, stream['viewers'], stream['channel']['followers'], stream['channel']['status'].to_s.gsub(/\n/,'') ) + printf( "%-45s %-36s %6i %6i %-.#{width-46-37-7-7}s\n", stream['channel']['url'].to_s.sub(/http:\/\/.+?\./,''), stream['channel']['game'].to_s, stream['viewers'].to_i, stream['channel']['followers'].to_i, stream['channel']['status'].to_s.gsub(/\n/,'') ) end offset += 100 -- cgit v1.2.3