Skip to content
Permalink
Browse files

Fix error downloading videos without converting to audio

  • Loading branch information...
spurll committed Sep 15, 2019
1 parent d4b69d4 commit 4d118600612eb8628a0b1c538cdbd2e7b98f7a01
Showing with 9 additions and 10 deletions.
  1. +9 −10 ytdl/views.py
19 ytdl/views.py 100644 → 100755
@@ -26,18 +26,17 @@ def index():

fmt = form.fmt.data

command = [
'youtube-dl', form.url.data, '-o',
os.path.join(directory, '%(title)s.%(ext)s')
]

if fmt != 'v':
command.extend(['-x', f'--audio-format={fmt}'])

try:
# Download the file
process = run(
[
'youtube-dl',
form.url.data,
'-o', os.path.join(directory, '%(title)s.%(ext)s'),
'-x' if fmt != 'v' else '',
f'--audio-format={fmt}' if fmt != 'v' else ''
],
check=True
)
process = run(command, check=True)

except Exception as e:
print(e)

0 comments on commit 4d11860

Please sign in to comment.
You can’t perform that action at this time.