23 lines
		
	
	
		
			754 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			754 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env bash
 | 
						|
 | 
						|
CLIENT_ID=SET_CLIENT_ID_HERE
 | 
						|
OAUTH_TOKEN=SET_OAUTH_TOKEN_HERE
 | 
						|
 | 
						|
if [ -z "$1" ]; then
 | 
						|
  curl -s \
 | 
						|
    -H 'Accept: application/vnd.twitchtv.v5+json' \
 | 
						|
    -H "Client-ID: ${TWITCH_CLIENT_ID:-$CLIENT_ID}" \
 | 
						|
    -H "Authorization: OAuth ${TWITCH_OAUTH_TOKEN:-$OAUTH_TOKEN}" \
 | 
						|
    -X GET 'https://api.twitch.tv/kraken/streams/followed' | \
 | 
						|
  ramda \
 | 
						|
    'tap (res) -> if res.error then console.error(res); process.exit(1)' \
 | 
						|
    '.streams' \
 | 
						|
    'map pick-dot-paths [\channel.name, \channel.status, \game, \viewers]' \
 | 
						|
    'map flat' \
 | 
						|
    'map (rename-keys-by split(".") >> last)' \
 | 
						|
    '-> if is-empty(it) then "No one you are following is streaming right now." else it' \
 | 
						|
    -o table
 | 
						|
else
 | 
						|
  streamlink -p mpv twitch.tv/$1 ${2:-best}
 | 
						|
fi
 |