summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk@action.fairlystable.org>2023-05-03 01:36:38 -0700
committerJoe Rayhawk <jrayhawk@action.fairlystable.org>2023-05-03 01:36:38 -0700
commitd5858e2ef8f382b9e53308301ff7c7df3bf4b745 (patch)
tree88d3239f1a693f8702eac4d41490a3c95a21bf1d
parenta5ae979dba586526b18f9a2a08f2748b3968aea0 (diff)
downloadtwitcr-d5858e2ef8f382b9e53308301ff7c7df3bf4b745.tar.gz
twitcr-d5858e2ef8f382b9e53308301ff7c7df3bf4b745.zip
enable unfiltered stream listing
-rw-r--r--src/twitcr/rest.cr1
-rw-r--r--util/twitch.cr6
2 files changed, 6 insertions, 1 deletions
diff --git a/src/twitcr/rest.cr b/src/twitcr/rest.cr
index 5286aeb..1be3190 100644
--- a/src/twitcr/rest.cr
+++ b/src/twitcr/rest.cr
@@ -123,6 +123,7 @@ module Twitcr::REST
def get_streams( user_ids : Array( UInt64 ) ); request( "GET", Api::Helix, "/streams?user_id=#{user_ids.join( "&user_id=" )}" ) end
def get_streams( user_id : UInt64 ); request( "GET", Api::Helix, "/streams?user_id=#{user_id}" ) end
def get_streams( game_id : UInt64 ); request( "GET", Api::Helix, "/streams?first=100&game_id=#{game_id}" ) end
+ def get_streams(); request( "GET", Api::Helix, "/streams?first=100" ) end
# Kraken returns more information
def get_streams_v5( game : String ); request( "GET", Api::Kraken, "/streams?limit=100&game=#{URI.encode_www_form( game )}" ) end
def get_streams_v5( *, channel : ( Array( UInt64 ) | UInt64 | Nil ) = nil, game : String? = nil, language : String? = nil, stream_type : String? = nil );
diff --git a/util/twitch.cr b/util/twitch.cr
index 87908ae..43980d0 100644
--- a/util/twitch.cr
+++ b/util/twitch.cr
@@ -60,7 +60,11 @@ when "clips"
when "game"
pp JSON.parse( client.get_games( ARGV[1].to_u64? || ARGV[1] ) )
when "streams"
- list_streams( settings, JSON.parse( client.get_streams( game_id = client.game_id( ARGV[1] ) ) ) )
+ if ARGV[1]?
+ list_streams( settings, JSON.parse( client.get_streams( game_id = client.game_id( ARGV[1] ) ) ) )
+ else
+ list_streams( settings, JSON.parse( client.get_streams() ) )
+ end
when "streams_kraken"
list_streams_v5( settings, client, ARGV[1] )
when "hosts"