import sys import os import subprocess from subprocess import Popen, PIPE, STDOUT def run(cmd): p = Popen(cmd , stdout=PIPE) for line in iter(p.stdout.readline, b''): print(str(line).replace("\\n'",' ').replace("b'", '')) p.terminate() exe = 'youtube-dl' try: url = str(sys.argv[1]) print('URL: ' + url) except Exception as e: print('[x] URL invalida!') exit() cmdFormatList = exe + ' -F ' + url run(cmdFormatList) print('[o] Select your format: 137+140') try: in_format = eval("raw_input('format: ')") except: in_format = eval("input('format: ')") cmdDownload = exe +' '+ url + ' -f ' + in_format + ' --ffmpeg-location "' + os.getenv('tools') + 'ffmpeg\\bin"' + ' -o "%(title)s.%(ext)s"' run(cmdDownload)