diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-09-22 05:25:17 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-09-22 05:25:17 +0530 |
commit | bd6f722de8d44958ebc1b4b80bb59cbcb37c8ff3 (patch) | |
tree | 73b85730f28b53da6cec9d6cfbc30f7710766929 | |
parent | d9d8b857477d8797ab1b55a99684d6d71959c51b (diff) | |
download | hypervideo-pre-bd6f722de8d44958ebc1b4b80bb59cbcb37c8ff3.tar.lz hypervideo-pre-bd6f722de8d44958ebc1b4b80bb59cbcb37c8ff3.tar.xz hypervideo-pre-bd6f722de8d44958ebc1b4b80bb59cbcb37c8ff3.zip |
dump files should obey `--trim-filename` (#1043)
Authored by: sulyi
-rw-r--r-- | yt_dlp/extractor/common.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index f6ca686a3..ae03c1bab 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -789,9 +789,10 @@ class InfoExtractor(object): self._downloader.to_screen(dump) if self.get_param('write_pages', False): basen = '%s_%s' % (video_id, urlh.geturl()) - if len(basen) > 240: + trim_length = self.get_param('trim_file_name') or 240 + if len(basen) > trim_length: h = '___' + hashlib.md5(basen.encode('utf-8')).hexdigest() - basen = basen[:240 - len(h)] + h + basen = basen[:trim_length - len(h)] + h raw_filename = basen + '.dump' filename = sanitize_filename(raw_filename, restricted=True) self.to_screen('Saving request to ' + filename) |