Created
December 4, 2020 12:33
-
-
Save amireshoon/11751d1a8be6011b7b0bc3d790249ff4 to your computer and use it in GitHub Desktop.
Stream a youtube live in python with pafy and vlc
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
import pafy | |
import vlc | |
url = "https://www.youtube.com/watch?v=5qap5aO4i9A" | |
video = pafy.new(url) | |
best = video.getbest() | |
playurl = best.url | |
Instance = vlc.Instance() | |
player = Instance.media_player_new() | |
Media = Instance.media_new(playurl) | |
Media.get_mrl() | |
player.set_media(Media) | |
player.play() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment