From 089b97cfee8553886d33cd52b7ede178cebd7034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Sun, 16 Jul 2017 04:30:48 +0700 Subject: [PATCH] [nexx] Improve JS embed extraction --- youtube_dl/extractor/nexx.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/youtube_dl/extractor/nexx.py b/youtube_dl/extractor/nexx.py index 60b42cb7d..12450d4c5 100644 --- a/youtube_dl/extractor/nexx.py +++ b/youtube_dl/extractor/nexx.py @@ -72,13 +72,17 @@ def _extract_urls(webpage): entries = [] # JavaScript Integration - for domain_id, video_id in re.findall( - r'''(?isx) - ]+\bsrc=["\']https?://require\.nexx(?:\.cloud|cdn\.com)/(\d+).+? - onPLAYReady.+? - _play\.init\s*\(.+?\s*,\s*(\d+)\s*,\s*.+?\) - ''', webpage): - entries.append('https://api.nexx.cloud/v3/%s/videos/byid/%s' % (domain_id, video_id)) + mobj = re.search( + r']+\bsrc=["\']https?://require\.nexx(?:\.cloud|cdn\.com)/(?P\d+)', + webpage) + if mobj: + domain_id = mobj.group('id') + for video_id in re.findall( + r'(?is)onPLAYReady.+?_play\.init\s*\(.+?\s*,\s*["\']?(\d+)', + webpage): + entries.append( + 'https://api.nexx.cloud/v3/%s/videos/byid/%s' + % (domain_id, video_id)) # TODO: support more embed formats