1
0
Fork 0
mirror of https://codeberg.org/polarisfm/youtube-dl.git synced 2024-12-25 09:11:34 +00:00

[utils] Fix inconsistent output of clean_html

`\s` in Python 2.x doesn't match unicode whitespace characters by
default
This commit is contained in:
Tithen-Firion 2017-04-28 17:34:27 +02:00
parent bc8a2ea071
commit edd9221cd2

View file

@ -421,8 +421,8 @@ def clean_html(html):
# Newline vs <br />
html = html.replace('\n', ' ')
html = re.sub(r'\s*<\s*br\s*/?\s*>\s*', '\n', html)
html = re.sub(r'<\s*/\s*p\s*>\s*<\s*p[^>]*>', '\n', 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