I have been trying to play the YouTube links from python using pafy
and python-vlc
. The code compiles and finishes but the link doesn't play through vlc
even though I have called play()
at bottom
I have tried uninstalling the existing python-vlc
and reinstalling it but the problem persists, I was using sublime text editor for running above code and so I tried this with python IDLE but everything was:
same
import vlc
import pafy
url = "https://www.youtube.com/watch?v=VwsmkB-YpJo"
video = pafy.new(url)
best = video.getbest()
playurl = best.url
ins = vlc.Instance()
player = ins.media_player_new()
Media = ins.media_new(playurl)
Media.get_mrl()
player.set_media(Media)
player.play()
I expected as an output the video will play but actually it finished up with no any response and errors