Last active
September 4, 2022 19:21
-
-
Save shmup/c690b3dcc7b59433d6e5c14396a9d550 to your computer and use it in GitHub Desktop.
twitch.tv helper script to stream to external player
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# $HOME/bin/twitch | |
# fuzzy filtering https://github.com/jhawthorn/fzy | |
# streams via mpv and https://github.com/streamlink/streamlink | |
# twitch chat via irc https://gist.github.com/shmup/0a144a44a24aadc8679bc2e5889e7284 | |
# usage: twitch | |
PLAYER="mpv" | |
PLAYER_ARGS="--really-quiet" | |
# usage: twitch browse | |
OPENER=$([[ "$OSTYPE" != "darwin"* ]] && echo xdg-open || echo open) | |
[[ $1 == "browse" ]] && $OPENER "https://www.twitch.tv/directory/following" | |
TWITCHES=( | |
"1dnsl" | |
"bgcozycave" | |
"blindirl" | |
"civictv83" | |
"civictv85" | |
"dkutelevision" | |
"evo" | |
"forgotten_vcr" | |
"fort90filmclub" | |
"gamesdonequick" | |
"goodbadflicks" | |
"kinorelax" | |
"kpblive" | |
"mediocrefilms" | |
"missmollyrogers" | |
"mondaymoviemadness" | |
"oldtimeycomputershow" | |
"pisshospital" | |
"retropals" | |
"ryan_hart" | |
"segfest" | |
"sickovision" | |
"thatweekinsnl" | |
"themidnightnow" | |
"unlimitedhangouts" | |
"utopiadistrict" | |
"waveydelights" | |
"wondervillenyc" | |
) | |
SELECTION=$(printf "%s\n" "${TWITCHES[@]}" | fzy -l 40) | |
[[ -z $SELECTION ]] && echo "xoxo" && exit 0 | |
# run --quiet[ly] in the background | |
streamlink \ | |
--player "$PLAYER" \ | |
--player-args "$PLAYER_ARGS" \ | |
--quiet \ | |
--default-stream best \ | |
--retry-streams 3 \ | |
--url "twitch.tv/$SELECTION" & | |
# http://ix.io/45YD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment