Skip to content

Commit

Permalink
positive look ahead is not required, and casuses issues with Python 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
back-to authored and beardypig committed Jul 30, 2018
1 parent 8b00cf2 commit 974725e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/streamlink/plugin/api/utils.py
Expand Up @@ -7,7 +7,7 @@
__all__ = ["parse_json", "parse_xml", "parse_query"]


tag_re = re.compile('''(?=<(?P<tag>[a-zA-Z]+)(?P<attr>.*?)(?P<end>/)?>(?:(?P<inner>.*?)</\s*(?P=tag)\s*>)?)''',
tag_re = re.compile('''<(?P<tag>[a-zA-Z]+)(?P<attr>.*?)(?P<end>/)?>(?:(?P<inner>.*?)</\s*(?P=tag)\s*>)?''',
re.MULTILINE | re.DOTALL)
attr_re = re.compile('''\s*(?P<key>[\w-]+)\s*(?:=\s*(?P<quote>["']?)(?P<value>.*?)(?P=quote)\s*)?''')
Tag = namedtuple("Tag", "tag attributes text")
Expand All @@ -17,7 +17,6 @@ def itertags(html, tag):
"""
Brute force regex based HTML tag parser. This is a rough-and-ready searcher to find HTML tags when
standards compliance is not required. Will find tags that are commented out, or inside script tag etc.
:param html: HTML page
:param tag: tag name to find
:return: generator with Tags
Expand All @@ -26,4 +25,3 @@ def itertags(html, tag):
if match.group("tag") == tag:
attrs = dict((a.group("key").lower(), a.group("value")) for a in attr_re.finditer(match.group("attr")))
yield Tag(match.group("tag"), attrs, match.group("inner"))

0 comments on commit 974725e

Please sign in to comment.