about summary refs log tree commit diff
path: root/youtube_dl/extractor/charlierose.py
diff options
context:
space:
mode:
authorDéstin Reed <trox1972@users.noreply.github.com>2016-08-19 12:53:34 +0200
committerDéstin Reed <trox1972@users.noreply.github.com>2016-08-21 11:29:48 +0200
commitdb29af6d36b3d16614355dac70f22c4f2d8410d2 (patch)
tree9d0ed2b1e76c8f784bd8691c263c387824b1e40b /youtube_dl/extractor/charlierose.py
parent39e1c4f08c4cfca81943e73523bd66b890f5aff2 (diff)
downloadyoutube-dl-db29af6d36b3d16614355dac70f22c4f2d8410d2.tar.gz
youtube-dl-db29af6d36b3d16614355dac70f22c4f2d8410d2.tar.xz
youtube-dl-db29af6d36b3d16614355dac70f22c4f2d8410d2.zip
[charlierose] Add new extractor
Diffstat (limited to 'youtube_dl/extractor/charlierose.py')
-rw-r--r--youtube_dl/extractor/charlierose.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/youtube_dl/extractor/charlierose.py b/youtube_dl/extractor/charlierose.py
new file mode 100644
index 000000000..ba1d1b833
--- /dev/null
+++ b/youtube_dl/extractor/charlierose.py
@@ -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'),
+        }