浏览代码

[utils] Fix inconsistent output of clean_html

`\s` in Python 2.x doesn't match unicode whitespace characters by
default
Tithen-Firion 8 年之前
父节点
当前提交
edd9221cd2
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      youtube_dl/utils.py

+ 2 - 2
youtube_dl/utils.py

@@ -421,8 +421,8 @@ def clean_html(html):
 
 
     # Newline vs <br />
     # Newline vs <br />
     html = html.replace('\n', ' ')
     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
     # Strip html tags
     html = re.sub('<.*?>', '', html)
     html = re.sub('<.*?>', '', html)
     # Replace html entities
     # Replace html entities