4 from .common import InfoExtractor
7 class PBSIE(InfoExtractor):
8 _VALID_URL = r'https?://video.pbs.org/video/(?P<id>\d+)/?'
11 u'url': u'http://video.pbs.org/video/2365006249/',
12 u'file': u'2365006249.mp4',
13 u'md5': 'ce1888486f0908d555a8093cac9a7362',
15 u'title': u'A More Perfect Union',
16 u'description': u'md5:ba0c207295339c8d6eced00b7c363c6a',
21 def _real_extract(self, url):
22 mobj = re.match(self._VALID_URL, url)
23 video_id = mobj.group('id')
24 info_url = 'http://video.pbs.org/videoInfo/%s?format=json' % video_id
25 info_page = self._download_webpage(info_url, video_id)
26 info =json.loads(info_page)
27 return {'id': video_id,
28 'title': info['title'],
29 'url': info['alternate_encoding']['url'],
31 'description': info['program'].get('description'),
32 'thumbnail': info.get('image_url'),
33 'duration': info.get('duration'),