mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-23 02:25:11 +00:00
[extractor/generic] Avoid catastrophic backtracking in KVS regex
Authored by: bashonly
This commit is contained in:
parent
37e325b92f
commit
8aa0bd5d10
1 changed files with 3 additions and 3 deletions
|
@ -2637,11 +2637,11 @@ def _extract_embeds(self, url, webpage, *, urlh=None, info_dict={}):
|
||||||
|
|
||||||
# Look for generic KVS player (before json-ld bc of some urls that break otherwise)
|
# Look for generic KVS player (before json-ld bc of some urls that break otherwise)
|
||||||
found = self._search_regex((
|
found = self._search_regex((
|
||||||
r'<script\b[^>]+?\bsrc\s*=\s*(["\'])https?://(?:\S+?/)+kt_player\.js\?v=(?P<ver>\d+(?:\.\d+)+)\1[^>]*>',
|
r'<script\b[^>]+?\bsrc\s*=\s*(["\'])https?://(?:(?!\1)[^?#])+/kt_player\.js\?v=(?P<ver>\d+(?:\.\d+)+)\1[^>]*>',
|
||||||
r'kt_player\s*\(\s*(["\'])(?:(?!\1)[\w\W])+\1\s*,\s*(["\'])https?://(?:\S+?/)+kt_player\.swf\?v=(?P<ver>\d+(?:\.\d+)+)\2\s*,',
|
r'kt_player\s*\(\s*(["\'])(?:(?!\1)[\w\W])+\1\s*,\s*(["\'])https?://(?:(?!\2)[^?#])+/kt_player\.swf\?v=(?P<ver>\d+(?:\.\d+)+)\2\s*,',
|
||||||
), webpage, 'KVS player', group='ver', default=False)
|
), webpage, 'KVS player', group='ver', default=False)
|
||||||
if found:
|
if found:
|
||||||
self.report_detected('KWS Player')
|
self.report_detected('KVS Player')
|
||||||
if found.split('.')[0] not in ('4', '5', '6'):
|
if found.split('.')[0] not in ('4', '5', '6'):
|
||||||
self.report_warning(f'Untested major version ({found}) in player engine - download may fail.')
|
self.report_warning(f'Untested major version ({found}) in player engine - download may fail.')
|
||||||
return [self._extract_kvs(url, webpage, video_id)]
|
return [self._extract_kvs(url, webpage, video_id)]
|
||||||
|
|
Loading…
Reference in a new issue