]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[charlierose] Add new extractor
authorDéstin Reed <trox1972@users.noreply.github.com>
Fri, 19 Aug 2016 10:53:34 +0000 (12:53 +0200)
committerDéstin Reed <trox1972@users.noreply.github.com>
Sun, 21 Aug 2016 09:29:48 +0000 (11:29 +0200)
youtube_dl/extractor/charlierose.py [new file with mode: 0644]
youtube_dl/extractor/extractors.py

diff --git a/youtube_dl/extractor/charlierose.py b/youtube_dl/extractor/charlierose.py
new file mode 100644 (file)
index 0000000..ba1d1b8
--- /dev/null
@@ -0,0 +1,45 @@
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import remove_end
+
+
+class CharlieRoseIE(InfoExtractor):
+    _VALID_URL = r'https?://(?:www\.)?charlierose\.com/video(?:s|/player)/(?P<id>\d+)'
+    _TEST = {
+        'url': 'https://charlierose.com/videos/27996',
+        'info_dict': {
+            'id': '27996',
+            'ext': 'mp4',
+            'title': 'Remembering Zaha Hadid',
+            'thumbnail': 're:^https?://.*\.jpg\?\d+',
+            'description': 'We revisit past conversations with Zaha Hadid, in memory of the world renowned Iraqi architect.',
+        },
+        'params': {
+            # m3u8 download
+            'skip_download': True,
+        }
+    }
+
+    _PLAYER_BASE = 'https://charlierose.com/video/player/%s'
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+        webpage = self._download_webpage(self._PLAYER_BASE % video_id, video_id)
+
+        title = remove_end(self._og_search_title(webpage), ' - Charlie Rose')
+
+        entries = self._parse_html5_media_entries(self._PLAYER_BASE % video_id, webpage, video_id)[0]
+        formats = entries['formats']
+
+        self._sort_formats(formats)
+        self._remove_duplicate_formats(formats)
+
+        return {
+            'id': video_id,
+            'title': title,
+            'formats': formats,
+            'thumbnail': self._og_search_thumbnail(webpage),
+            'description': self._og_search_description(webpage),
+            'subtitles': entries.get('subtitles'),
+        }
index 6c5d46015ca720abc16495c4786a46e98201d77d..d4d90c1f8d8dfa72894f74dd3a448716d48d592b 100644 (file)
@@ -134,6 +134,7 @@ from .ccc import CCCIE
 from .cda import CDAIE
 from .ceskatelevize import CeskaTelevizeIE
 from .channel9 import Channel9IE
+from .charlierose import CharlieRoseIE
 from .chaturbate import ChaturbateIE
 from .chilloutzone import ChilloutzoneIE
 from .chirbit import (