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:
parent
560145a4ff
commit
db426b804c
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user