about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2017-12-11 14:37:03 +0100
committerRemita Amine <remitamine@gmail.com>2017-12-11 14:37:03 +0100
commit5868079e9921bfb03c64439d2188b765fc30dcfc (patch)
treec1d7a79360d9f55548c6251e8719c44fb2b205d6
parentb6f78d76c14a1787606aad23c2df0d5158d1fde1 (diff)
downloadyoutube-dl-5868079e9921bfb03c64439d2188b765fc30dcfc.tar.gz
youtube-dl-5868079e9921bfb03c64439d2188b765fc30dcfc.tar.xz
youtube-dl-5868079e9921bfb03c64439d2188b765fc30dcfc.zip
[nick.com] improve extraction(fixes #14876)
-rw-r--r--youtube_dl/extractor/nick.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/youtube_dl/extractor/nick.py b/youtube_dl/extractor/nick.py
index 310eea2cf..cae8faf3e 100644
--- a/youtube_dl/extractor/nick.py
+++ b/youtube_dl/extractor/nick.py
@@ -10,7 +10,7 @@ from ..utils import update_url_query
 class NickIE(MTVServicesInfoExtractor):
     # None of videos on the website are still alive?
     IE_NAME = 'nick.com'
-    _VALID_URL = r'https?://(?:(?:www|beta)\.)?nick(?:jr)?\.com/(?:[^/]+/)?(?:videos/clip|[^/]+/videos)/(?P<id>[^/?#.]+)'
+    _VALID_URL = r'https?://(?P<domain>(?:(?:www|beta)\.)?nick(?:jr)?\.com)/(?:[^/]+/)?(?:videos/clip|[^/]+/videos)/(?P<id>[^/?#.]+)'
     _FEED_URL = 'http://udat.mtvnservices.com/service1/dispatch.htm'
     _GEO_COUNTRIES = ['US']
     _TESTS = [{
@@ -69,8 +69,14 @@ class NickIE(MTVServicesInfoExtractor):
             'mgid': uri,
         }
 
-    def _extract_mgid(self, webpage):
-        return self._search_regex(r'data-contenturi="([^"]+)', webpage, 'mgid')
+    def _real_extract(self, url):
+        domain, display_id = re.match(self._VALID_URL, url).groups()
+        video_data = self._download_json(
+            'http://%s/data/video.endLevel.json' % domain,
+            display_id, query={
+                'urlKey': display_id,
+            })
+        return self._get_videos_info(video_data['player'] + video_data['id'])
 
 
 class NickDeIE(MTVServicesInfoExtractor):