youtube downloader
def youtube_dl(url): """ Downloads the youtube video at url """ # first download the file with youtube-dl subprocess.call(['youtube-dl', '-o', '%(title)s.%(ext)s', url]) # get the title of the video video_title = subprocess.check_output(['youtube-dl', '--get-title', url]).decode('utf-8').strip() # get the extension of the video video_ext = subprocess.check_output(['youtube-dl', '--get-filename', '--restrict-filenames', url]).decode('utf-8').strip().split('.')[-1] # remove the file extension os.rename(video_title + '.' + video_ext, video_title) # open the video with VLC subprocess.check_output(['vlc', video_title]) # remove the video file os.remove(video_title) for link in sys.stdin