Advertisement
Guest User

Untitled

a guest
Apr 24th, 2023
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # List of channels you want to view
  4. channels=("twitch.tv/lirik" "twitch.tv/ninja" "youtube.com/channel/UCiDFDL2XzFvZSK4WvGrBCTg/live")
  5.  
  6. # Use Streamlink to get available streams for each channel
  7. declare -A streams
  8. for channel in "${channels[@]}"
  9. do
  10. streams["$channel"]=$(streamlink --json "$channel" | jq -r '.streams | keys[]')
  11. done
  12.  
  13. # Print available streams for each channel
  14. for channel in "${channels[@]}"
  15. do
  16. echo "Available streams for $channel:"
  17. for stream in ${streams["$channel"]}
  18. do
  19. echo "$stream"
  20. done
  21. done
  22.  
  23. # Ask user to select a stream to view
  24. read -p "Enter the channel you want to view: " selected_channel
  25. if ! [[ " ${channels[@]} " =~ " ${selected_channel} " ]]; then
  26. echo "Invalid channel selected."
  27. exit 1
  28. fi
  29.  
  30. read -p "Enter the stream for $selected_channel you want to view: " selected_stream
  31. if ! [[ " ${streams["$selected_channel"]} " =~ " ${selected_stream} " ]]; then
  32. echo "Invalid stream selected."
  33. exit 1
  34. fi
  35.  
  36. # Use Streamlink to launch the selected stream in VLC media player
  37. stream_url=$(streamlink --json "$selected_channel" | jq -r ".streams[\"$selected_stream\"].url")
  38. vlc "$stream_url"
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement