elearning.py: fix bug when video has no description
This commit is contained in:
parent
1165fc4f79
commit
04a62c834b
@ -250,6 +250,10 @@ def save_video(infos, files, args):
|
||||
urls = (i['downloadUrl'] for i in infos)
|
||||
info = infos[0]
|
||||
|
||||
# fallback to name if no description
|
||||
if not info['description']:
|
||||
info['description'] = info['name']
|
||||
|
||||
# use the description as a filename
|
||||
title = []
|
||||
for word in info['description'].split():
|
||||
@ -282,7 +286,7 @@ def save_video(infos, files, args):
|
||||
ffmpeg = [
|
||||
'ffmpeg', '-hide_banner',
|
||||
'-loglevel', 'error',
|
||||
'-stats', '-y'
|
||||
'-stats'
|
||||
] + inputs + maps + args.ffmpeg + [
|
||||
# video
|
||||
'-c:v', 'libx265', '-preset', 'slow', '-crf', '23',
|
||||
@ -361,10 +365,10 @@ def main(args):
|
||||
else:
|
||||
print('url:', info[0]['downloadUrl'])
|
||||
printr()
|
||||
if args.json:
|
||||
output.append(info)
|
||||
else:
|
||||
save_video(info, files, args)
|
||||
if args.json:
|
||||
output.append(info)
|
||||
|
||||
if args.json:
|
||||
print(json.dumps(output))
|
||||
|
Loading…
Reference in New Issue
Block a user