mirror of
https://github.com/l1ving/youtube-dl
synced 2025-02-05 17:02:58 +08:00
Trim and collapse whitespace from filename
This commit is contained in:
parent
2b4f5e68d1
commit
797c86ad36
@ -359,6 +359,7 @@ def sanitize_filename(s, restricted=False, is_id=False):
|
|||||||
while '__' in result:
|
while '__' in result:
|
||||||
result = result.replace('__', '_')
|
result = result.replace('__', '_')
|
||||||
result = result.strip('_')
|
result = result.strip('_')
|
||||||
|
result = " ".join(result.split())
|
||||||
# Common case of "Foreign band name - English song title"
|
# Common case of "Foreign band name - English song title"
|
||||||
if restricted and result.startswith('-_'):
|
if restricted and result.startswith('-_'):
|
||||||
result = result[2:]
|
result = result[2:]
|
||||||
|
Loading…
Reference in New Issue
Block a user