Put vid title at end of download urls so downloads w/ that filename

This commit is contained in:
James Taylor
2020-10-22 14:30:33 -07:00
parent f8b6db1480
commit 5f4884dce8
3 changed files with 68 additions and 0 deletions

View File

@@ -398,6 +398,17 @@ def get_watch_page(video_id=None):
for fmt in info['formats']:
fmt['url'] = util.prefix_url(fmt['url'])
# Add video title to end of url path so it has a filename other than just
# "videoplayback" when downloaded
title = urllib.parse.quote(util.to_valid_filename(info['title']))
for fmt in info['formats']:
filename = title
ext = fmt.get('ext')
if ext:
filename += '.' + ext
fmt['url'] = fmt['url'].replace(
'/videoplayback',
'/videoplayback/name/' + filename)
if settings.gather_googlevideo_domains:
with open(os.path.join(settings.data_dir, 'googlevideo-domains.txt'), 'a+', encoding='utf-8') as f: