optimize html_uniform (#449)

This commit is contained in:
Michele Zuccalà
2024-01-05 11:54:38 +01:00
committed by GitHub
parent a3999d2746
commit 6ddec976b9

2
core/support.py Executable file → Normal file
View File

@@ -496,7 +496,7 @@ def html_uniform(data):
"""
replace all ' with " and eliminate newline, so we don't need to worry about
"""
return re.sub("='([^']+)'", '="\\1"', data.replace('\n', ' ').replace('\t', ' ').replace(' ', ' '))
return re.sub(r"\s+| ", " " , re.sub("='([^']+)'", '="\\1"', data))
def scrape(func):