Guest User

Untitled

a guest
Apr 24th, 2023
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. import streamlink
  2. import subprocess
  3.  
  4. # List of channels you want to view
  5. channels = ['twitch.tv/lirik', 'twitch.tv/ninja', 'youtube.com/channel/UCiDFDL2XzFvZSK4WvGrBCTg/live']
  6.  
  7. # Use Streamlink to get available streams for each channel
  8. streams = {}
  9. for channel in channels:
  10. streams[channel] = streamlink.streams(channel)
  11.  
  12. # Print available streams for each channel
  13. for channel, available_streams in streams.items():
  14. print(f"Available streams for {channel}:")
  15. for stream in available_streams:
  16. print(stream)
  17.  
  18. # Ask user to select a stream to view
  19. selected_channel = input("Enter the channel you want to view: ")
  20. if selected_channel not in channels:
  21. print("Invalid channel selected.")
  22. exit()
  23.  
  24. selected_stream = input(f"Enter the stream for {selected_channel} you want to view: ")
  25. if selected_stream not in streams[selected_channel]:
  26. print("Invalid stream selected.")
  27. exit()
  28.  
  29. # Use Streamlink to launch the selected stream in VLC media player
  30. stream_url = streams[selected_channel][selected_stream].url
  31. subprocess.call(['vlc', stream_url])
  32.  
Advertisement
Add Comment
Please, Sign In to add comment