-with tempfile.NamedTemporaryFile(suffix='youtube-dl', delete=True) as ytdl_file:
- with urllib.request.urlopen(URL) as dl:
- shutil.copyfileobj(dl, ytdl_file)
-
- ytdl_file.seek(0)
- data = ytdl_file.read()
-
- ytdl_file.flush()
- version = subprocess.check_output(['python3', ytdl_file.name, '--version']).decode('ascii').strip()