]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[espn] Add new extractor for http://fivethirtyeight.com(closes #6864)
authorRemita Amine <remitamine@gmail.com>
Tue, 26 Dec 2017 13:20:21 +0000 (14:20 +0100)
committerRemita Amine <remitamine@gmail.com>
Tue, 26 Dec 2017 13:20:21 +0000 (14:20 +0100)
youtube_dl/extractor/espn.py
youtube_dl/extractor/extractors.py

index 0e135b8bc708fab39a897cf6d7b63976d0f80b11..127c69b2eb668b85236eccfaccc63dcb7dd9d714 100644 (file)
@@ -205,3 +205,34 @@ class ESPNArticleIE(InfoExtractor):
 
         return self.url_result(
             'http://espn.go.com/video/clip?id=%s' % video_id, ESPNIE.ie_key())
 
         return self.url_result(
             'http://espn.go.com/video/clip?id=%s' % video_id, ESPNIE.ie_key())
+
+
+class FiveThirtyEightIE(InfoExtractor):
+    _VALID_URL = r'https?://(?:www\.)?fivethirtyeight\.com/features/(?P<id>[^/?#]+)'
+    _TEST = {
+        'url': 'http://fivethirtyeight.com/features/how-the-6-8-raiders-can-still-make-the-playoffs/',
+        'info_dict': {
+            'id': '21846851',
+            'ext': 'mp4',
+            'title': 'FiveThirtyEight: The Raiders can still make the playoffs',
+            'description': 'Neil Paine breaks down the simplest scenario that will put the Raiders into the playoffs at 8-8.',
+            'timestamp': 1513960621,
+            'upload_date': '20171222',
+        },
+        'params': {
+            'skip_download': True,
+        },
+        'expected_warnings': ['Unable to download f4m manifest'],
+    }
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+
+        webpage = self._download_webpage(url, video_id)
+
+        video_id = self._search_regex(
+            r'data-video-id=["\'](?P<id>\d+)',
+            webpage, 'video id', group='id')
+
+        return self.url_result(
+            'http://espn.go.com/video/clip?id=%s' % video_id, ESPNIE.ie_key())
index 3269ed743ec444939565a58397bff9e758beee2b..91bd3287ceb05f570e20dad8033e15ec7ed70484 100644 (file)
@@ -322,6 +322,7 @@ from .escapist import EscapistIE
 from .espn import (
     ESPNIE,
     ESPNArticleIE,
 from .espn import (
     ESPNIE,
     ESPNArticleIE,
+    FiveThirtyEightIE,
 )
 from .esri import EsriVideoIE
 from .etonline import ETOnlineIE
 )
 from .esri import EsriVideoIE
 from .etonline import ETOnlineIE