Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # List of channels you want to view
- channels=("twitch.tv/lirik" "twitch.tv/ninja" "youtube.com/channel/UCiDFDL2XzFvZSK4WvGrBCTg/live")
- # Use Streamlink to get available streams for each channel
- declare -A streams
- for channel in "${channels[@]}"
- do
- streams["$channel"]=$(streamlink --json "$channel" | jq -r '.streams | keys[]')
- done
- # Print available streams for each channel
- for channel in "${channels[@]}"
- do
- echo "Available streams for $channel:"
- for stream in ${streams["$channel"]}
- do
- echo "$stream"
- done
- done
- # Ask user to select a stream to view
- read -p "Enter the channel you want to view: " selected_channel
- if ! [[ " ${channels[@]} " =~ " ${selected_channel} " ]]; then
- echo "Invalid channel selected."
- exit 1
- fi
- read -p "Enter the stream for $selected_channel you want to view: " selected_stream
- if ! [[ " ${streams["$selected_channel"]} " =~ " ${selected_stream} " ]]; then
- echo "Invalid stream selected."
- exit 1
- fi
- # Use Streamlink to launch the selected stream in VLC media player
- stream_url=$(streamlink --json "$selected_channel" | jq -r ".streams[\"$selected_stream\"].url")
- vlc "$stream_url"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement