[nbc] Add MSNBCIE
authorYen Chi Hsuan <yan12125@gmail.com>
Wed, 19 Aug 2015 17:41:18 +0000 (01:41 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Wed, 19 Aug 2015 17:41:18 +0000 (01:41 +0800)
youtube_dl/extractor/__init__.py
youtube_dl/extractor/nbc.py

index b5f7ff9a95493099657b533f0a4f5a0d89a01a81..86ea0576a275d102dcd48f1e65a978e626822f7e 100644 (file)
@@ -358,6 +358,7 @@ from .nbc import (
     NBCNewsIE,
     NBCSportsIE,
     NBCSportsVPlayerIE,
+    MSNBCIE,
 )
 from .ndr import (
     NDRIE,
index ccdbfb6c9c42c3eb22101eb2f7080b4bda1df00d..e683d24c45f1d706f728eb90a8a26da880dbafa3 100644 (file)
@@ -236,3 +236,28 @@ class NBCNewsIE(InfoExtractor):
                 'url': info['videoAssets'][-1]['publicUrl'],
                 'ie_key': 'ThePlatform',
             }
+
+
+class MSNBCIE(InfoExtractor):
+    # https URLs redirect to corresponding http ones
+    _VALID_URL = r'http://www\.msnbc\.com/[^/]+/watch/(?P<id>[^/]+)'
+    _TEST = {
+        'url': 'http://www.msnbc.com/all-in-with-chris-hayes/watch/the-chaotic-gop-immigration-vote-314487875924',
+        'md5': '6d236bf4f3dddc226633ce6e2c3f814d',
+        'info_dict': {
+            'id': 'n_hayes_Aimm_140801_272214',
+            'ext': 'mp4',
+            'title': 'The chaotic GOP immigration vote',
+            'description': 'The Republican House votes on a border bill that has no chance of getting through the Senate or signed by the President and is drawing criticism from all sides.',
+            'thumbnail': 're:^https?://.*\.jpg$',
+            'timestamp': 1406937606,
+            'upload_date': '20140802',
+            'categories': ['MSNBC/Topics/Franchise/Best of last night', 'MSNBC/Topics/General/Congress'],
+        },
+    }
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+        webpage = self._download_webpage(url, video_id)
+        embed_url = self._html_search_meta('embedURL', webpage)
+        return self.url_result(embed_url)