Skip to content

Commit

Permalink
[PATCH] plugins: fix regex capture groups
Browse files Browse the repository at this point in the history
  • Loading branch information
bastimeyer authored and Billy2011 committed Aug 29, 2022
1 parent ba536ac commit 90abf7e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/streamlink/plugins/albavision.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ def _get_live_url(self):
schema = validate.Schema(
validate.xml_xpath_string(".//script[contains(text(), 'LIVE_URL')]/text()"),
validate.none_or_all(
re.compile(r"""LIVE_URL\s*=\s*(?P<q>['"])(.+?)(?P=q)"""),
re.compile(r"""LIVE_URL\s*=\s*(?P<q>['"])(?P<url>.+?)(?P=q)"""),
validate.none_or_all(
validate.get(1),
validate.get("url"),
validate.url(),
),
),
Expand All @@ -109,9 +109,9 @@ def _get_token_req_url(self):
schema = validate.Schema(
validate.xml_xpath_string(".//script[contains(text(), 'LIVE_URL')]/text()"),
validate.none_or_all(
re.compile(r"""jQuery\.get\s*\((?P<q>['"])(.+?)(?P=q)"""),
re.compile(r"""jQuery\.get\s*\((?P<q>['"])(?P<token>.+?)(?P=q)"""),
validate.none_or_all(
validate.get(1),
validate.get("token"),
validate.url(),
),
),
Expand All @@ -122,8 +122,8 @@ def _get_token_req_url(self):
schema = validate.Schema(
validate.xml_xpath_string(".//script[contains(text(), 'LIVE_URL')]/text()"),
validate.none_or_all(
re.compile(r"""Math\.floor\(Date\.now\(\)\s*/\s*3600000\),\s*(?P<q>['"])(.+?)(?P=q)"""),
validate.none_or_all(validate.get(1)),
re.compile(r"""Math\.floor\(Date\.now\(\)\s*/\s*3600000\),\s*(?P<q>['"])(?P<token>.+?)(?P=q)"""),
validate.none_or_all(validate.get("token")),
),
)
token_req_str = schema.validate(self.page)
Expand Down
7 changes: 5 additions & 2 deletions src/streamlink/plugins/hiplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ def _get_streams(self):
validate.parse_html(),
validate.xml_xpath_string(".//script[contains(text(), 'https://hiplayer.hibridcdn.net/l/')]/text()"),
validate.none_or_all(
re.compile(r"""(?P<q>['"])(https://hiplayer.hibridcdn.net/l/.+?)(?P=q)"""),
validate.none_or_all(validate.get(1), validate.url()),
re.compile(r"""(?P<q>['"])(?P<url>https://hiplayer.hibridcdn.net/l/.+?)(?P=q)"""),
validate.none_or_all(
validate.get("url"),
validate.url(),
),
),
),
)
Expand Down
7 changes: 5 additions & 2 deletions src/streamlink/plugins/htv.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,11 @@ def _get_streams(self):
validate.parse_html(),
validate.xml_xpath_string(".//script[contains(text(), 'playlist.m3u8')]/text()"),
validate.none_or_all(
re.compile(r"""var\s+iosUrl\s*=\s*(?P<q>")(.+?)(?P=q)"""),
validate.none_or_all(validate.get(1), validate.url()),
re.compile(r"""var\s+iosUrl\s*=\s*(?P<q>")(?P<url>.+?)(?P=q)"""),
validate.none_or_all(
validate.get("url"),
validate.url(),
),
),
),
)
Expand Down

0 comments on commit 90abf7e

Please sign in to comment.