diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-02-03 19:45:57 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-02-03 21:00:37 +0530 |
commit | 4918522735149b880586fc6b8cea31fa6a28e136 (patch) | |
tree | 64302193517a1a1c5455fb037f5c25c8d72edacc | |
parent | 65662dffb175d18b8b1de1d27f3b89a8a4a88b6b (diff) | |
download | hypervideo-pre-4918522735149b880586fc6b8cea31fa6a28e136.tar.lz hypervideo-pre-4918522735149b880586fc6b8cea31fa6a28e136.tar.xz hypervideo-pre-4918522735149b880586fc6b8cea31fa6a28e136.zip |
[utils] Strip double spaces in `clean_html`
Closes #2497
Authored by: dirkf
-rw-r--r-- | yt_dlp/utils.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index 13ad5fd48..fd3912d18 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -639,10 +639,9 @@ def clean_html(html): if html is None: # Convenience for sanitizing descriptions etc. return html - # Newline vs <br /> - html = html.replace('\n', ' ') - html = re.sub(r'(?u)\s*<\s*br\s*/?\s*>\s*', '\n', html) - html = re.sub(r'(?u)<\s*/\s*p\s*>\s*<\s*p[^>]*>', '\n', html) + html = re.sub(r'\s+', ' ', html) + html = re.sub(r'(?u)\s?<\s?br\s?/?\s?>\s?', '\n', html) + html = re.sub(r'(?u)<\s?/\s?p\s?>\s?<\s?p[^>]*>', '\n', html) # Strip html tags html = re.sub('<.*?>', '', html) # Replace html entities |