1 from __future__ import unicode_literals
6 from .common import InfoExtractor
9 class DiscoveryIE(InfoExtractor):
10 _VALID_URL = r'http://dsc\.discovery\.com\/[a-zA-Z0-9\-]*/[a-zA-Z0-9\-]*/videos/(?P<id>[a-zA-Z0-9\-]*)(.htm)?'
12 'url': 'http://dsc.discovery.com/tv-shows/mythbusters/videos/mission-impossible-outtakes.htm',
13 'md5': 'e12614f9ee303a6ccef415cb0793eba2',
17 'title': 'MythBusters: Mission Impossible Outtakes',
18 'description': ('Watch Jamie Hyneman and Adam Savage practice being'
19 ' each other -- to the point of confusing Jamie\'s dog -- and '
20 'don\'t miss Adam moon-walking as Jamie ... behind Jamie\'s'
26 def _real_extract(self, url):
27 mobj = re.match(self._VALID_URL, url)
28 video_id = mobj.group('id')
29 webpage = self._download_webpage(url, video_id)
31 video_list_json = self._search_regex(r'var videoListJSON = ({.*?});',
32 webpage, 'video list', flags=re.DOTALL)
33 video_list = json.loads(video_list_json)
34 info = video_list['clips'][0]
38 {'url': f['src'], 'ext': 'mp4', 'tbr': int(f['bitrate'][:-1])})
41 'id': info['contentId'],
42 'title': video_list['name'],
44 'description': info['videoCaption'],
45 'thumbnail': info.get('videoStillURL') or info.get('thumbnailURL'),
46 'duration': info['duration'],