1 from __future__ import unicode_literals
5 from .common import InfoExtractor
10 from ..compat import (
16 class DiscoveryIE(InfoExtractor):
17 _VALID_URL = r'''(?x)https?://(?:www\.)?(?:
19 investigationdiscovery|
27 )\.com/(?:[^/]+/)*(?P<id>[^./?#]+)'''
29 'url': 'http://www.discovery.com/tv-shows/mythbusters/videos/mission-impossible-outtakes.htm',
33 'title': 'Mission Impossible Outtakes',
34 'description': ('Watch Jamie Hyneman and Adam Savage practice being'
35 ' each other -- to the point of confusing Jamie\'s dog -- and '
36 'don\'t miss Adam moon-walking as Jamie ... behind Jamie\'s'
39 'timestamp': 1302032462,
40 'upload_date': '20110405',
41 'uploader_id': '103207',
44 'skip_download': True, # requires ffmpeg
47 'url': 'http://www.discovery.com/tv-shows/mythbusters/videos/mythbusters-the-simpsons',
49 'id': 'mythbusters-the-simpsons',
50 'title': 'MythBusters: The Simpsons',
52 'playlist_mincount': 10,
54 'url': 'http://www.animalplanet.com/longfin-eels-maneaters/',
58 'title': 'Longfin Eels: Maneaters?',
59 'description': 'Jeremy Wade tests whether or not New Zealand\'s longfin eels are man-eaters by covering himself in fish guts and getting in the water with them.',
60 'upload_date': '20140725',
61 'timestamp': 1406246400,
63 'uploader_id': '103207',
66 'skip_download': True, # requires ffmpeg
70 def _real_extract(self, url):
71 display_id = self._match_id(url)
72 info = self._download_json(url + '?flat=1', display_id)
74 video_title = info.get('playlist_title') or info.get('video_title')
78 for idx, video_info in enumerate(info['playlist']):
80 caption_url = video_info.get('captionsUrl')
89 '_type': 'url_transparent',
90 'url': 'http://players.brightcove.net/103207/default_default/index.html?videoId=ref:%s' % video_info['referenceId'],
91 'id': compat_str(video_info['id']),
92 'title': video_info['title'],
93 'description': video_info.get('description'),
94 'duration': parse_duration(video_info.get('video_length')),
95 'webpage_url': video_info.get('href') or video_info.get('url'),
96 'thumbnail': video_info.get('thumbnailURL'),
97 'alt_title': video_info.get('secondary_title'),
98 'timestamp': parse_iso8601(video_info.get('publishedDate')),
99 'subtitles': subtitles,
102 return self.playlist_result(entries, display_id, video_title)