]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[Yahoo/NBCSports] Fix #5226
authorYen Chi Hsuan <yan12125@gmail.com>
Mon, 30 Mar 2015 18:21:27 +0000 (02:21 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Mon, 30 Mar 2015 18:21:27 +0000 (02:21 +0800)
youtube_dl/extractor/__init__.py
youtube_dl/extractor/nbc.py
youtube_dl/extractor/yahoo.py

index 43bac0252bf68b443231c4416320759b8e126c19..5d0d2a9bc6f996364aa7703cfab67077eda8c093 100644 (file)
@@ -310,6 +310,7 @@ from .naver import NaverIE
 from .nba import NBAIE
 from .nbc import (
     NBCIE,
+    NBCSportsIE,
     NBCNewsIE,
 )
 from .ndr import NDRIE
index 80a01c778b6b8ae3b1ce2b65451fc8fd51e9dfb7..033bf71f0325899a76f04fede12313be12f7e872 100644 (file)
@@ -50,6 +50,27 @@ class NBCIE(InfoExtractor):
         return self.url_result(theplatform_url)
 
 
+class NBCSportsIE(InfoExtractor):
+    _VALID_URL = r'https?://vplayer\.nbcsports\.com/(?:[^/]+/)+(?P<id>[0-9a-zA-Z]+)'
+
+    _TEST = {
+        'url': 'https://vplayer.nbcsports.com/p/BxmELC/nbcsports_share/select/9CsDKds0kvHI',
+        'md5': 'ceae8dced5c14a1c1ffcb7a32194cca5',
+        'info_dict': {
+            'id': '9CsDKds0kvHI',
+            'ext': 'flv',
+            'description': 'md5:df390f70a9ba7c95ff1daace988f0d8d',
+            'title': 'Tyler Kalinoski hits buzzer-beater to lift Davidson',
+        }
+    }
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+        webpage = self._download_webpage(url, video_id)
+        theplatform_url = self._og_search_video_url(webpage)
+        return self.url_result(theplatform_url, 'ThePlatform')
+
+
 class NBCNewsIE(InfoExtractor):
     _VALID_URL = r'''(?x)https?://(?:www\.)?nbcnews\.com/
         (?:video/.+?/(?P<id>\d+)|
index 97dbac4cce53d7fe956b074fddbe40993fd5681f..6e72f1e5552d38d4a2baf8d2b14f3ce01ae3342c 100644 (file)
@@ -129,6 +129,15 @@ class YahooIE(InfoExtractor):
         }, {
             'url': 'https://gma.yahoo.com/pizza-delivery-man-surprised-huge-tip-college-kids-195200785.html',
             'only_matching': True,
+        }, {
+            'note': 'NBC Sports embeds',
+            'url': 'http://sports.yahoo.com/blogs/ncaab-the-dagger/tyler-kalinoski-s-buzzer-beater-caps-davidson-s-comeback-win-185609842.html?guid=nbc_cbk_davidsonbuzzerbeater_150313',
+            'info_dict': {
+                'id': '9CsDKds0kvHI',
+                'ext': 'flv',
+                'description': 'md5:df390f70a9ba7c95ff1daace988f0d8d',
+                'title': 'Tyler Kalinoski hits buzzer-beater to lift Davidson',
+            }
         }
     ]
 
@@ -151,6 +160,11 @@ class YahooIE(InfoExtractor):
                 items = json.loads(items_json)
                 video_id = items[0]['id']
                 return self._get_info(video_id, display_id, webpage)
+        # Look for NBCSports iframes
+        iframe_m = re.search(
+            r'<iframe[^>]+src="(?P<url>https?://vplayer\.nbcsports\.com/[^"]+)"', webpage)
+        if iframe_m:
+            return self.url_result(iframe_m.group('url'), 'NBCSports')
 
         items_json = self._search_regex(
             r'mediaItems: ({.*?})$', webpage, 'items', flags=re.MULTILINE,