Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pafy
- import vlc
- url = "https://www.youtube.com/watch?v=rfOY8ePOs_0"
- v = pafy.new(url)
- print(v.audiostreams)
- s = v.getbestaudio()
- print(s.url)
- instance = vlc.Instance("--sub-source marq --sout=#stream_out_duplicate{dst=display,dst=std{access=file,mux=ts,dst=stream.webm}}")
- p = instance.media_player_new()
- media = instance.media_new_location(s.url)
- p.set_media(media)
- p = vlc.MediaPlayer(s.url)
- p.play()
- pressed = True
- print(str(p.get_length()) + " " + str(p.get_time()))
- while True:
- if(p.is_playing()):
- pressed = False
- if((p.is_playing()==0) and pressed==False):
- print(str(p.get_length()) + " " + str(p.get_time()))
- print(str(p.is_playing()) + " " + str(pressed))
- break
- pass
- print("FINE")
Add Comment
Please, Sign In to add comment