diff options
author | James Taylor <user234683@users.noreply.github.com> | 2020-10-22 14:30:33 -0700 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2020-10-22 14:30:33 -0700 |
commit | 5f4884dce8e3eb3215ee8b97469a741310669083 (patch) | |
tree | 68b9406805ae2ea6e5e2e58480ba31823a6bbd0f /youtube/watch.py | |
parent | f8b6db14800806c132c6ec5c587832c0200ada6e (diff) | |
download | yt-local-5f4884dce8e3eb3215ee8b97469a741310669083.tar.lz yt-local-5f4884dce8e3eb3215ee8b97469a741310669083.tar.xz yt-local-5f4884dce8e3eb3215ee8b97469a741310669083.zip |
Put vid title at end of download urls so downloads w/ that filename
Diffstat (limited to 'youtube/watch.py')
-rw-r--r-- | youtube/watch.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/youtube/watch.py b/youtube/watch.py index 11ef9f2..bc2008c 100644 --- a/youtube/watch.py +++ b/youtube/watch.py @@ -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: |