1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-30 23:24:16 +01:00

Fix slow regex for grabbing title-tag.

Changes regex to not allow matching overlapping matches, which
made compilation of the regex noticeable slow.
This commit is contained in:
Anders Waldenborg 2014-01-04 22:17:21 +01:00
parent 560145a4ff
commit db426b804c

View File

@ -61,7 +61,7 @@ def get_media(url, options):
if not options.output or os.path.isdir(options.output): if not options.output or os.path.isdir(options.output):
data = get_http_data(url) data = get_http_data(url)
match = re.search(r"(?i)<title.*>\s*(.*?)\s*</title>", data) match = re.search(r"(?i)<title[^>]*>\s*(.*?)\s*</title>", data, re.S)
if match: if match:
title_tag = re.sub(r'&[^\s]*;', '', match.group(1)) title_tag = re.sub(r'&[^\s]*;', '', match.group(1))
if is_py3: if is_py3: