1 from __future__ import unicode_literals
6 from .common import InfoExtractor
12 class InfoQIE(InfoExtractor):
13 _VALID_URL = r'https?://(?:www\.)?infoq\.com/[^/]+/(?P<id>[^/]+)$'
17 u'url': u'http://www.infoq.com/presentations/A-Few-of-My-Favorite-Python-Things',
18 u'md5': u'fcaa3d995e04080dcb9465d86b5eef62',
20 u'id': u'12-jan-pythonthings',
22 u'description': u'Mike Pirnat presents some tips and tricks, standard libraries and third party packages that make programming in Python a richer experience.',
23 u'title': u'A Few of My Favorite [Python] Things',
27 def _real_extract(self, url):
28 mobj = re.match(self._VALID_URL, url)
29 video_id = mobj.group('id')
31 webpage = self._download_webpage(url, video_id)
33 self.report_extraction(video_id)
35 video_title = self._html_search_regex(r'<title>(.*?)</title>', webpage, 'title')
36 video_description = self._html_search_meta('description', webpage, 'description')
38 # The server URL is hardcoded
39 video_url = 'rtmpe://video.infoq.com/cfx/st/'
42 encoded_id = self._search_regex(r"jsclassref ?= ?'([^']*)'", webpage, 'encoded id')
43 real_id = compat_urllib_parse.unquote(base64.b64decode(encoded_id.encode('ascii')).decode('utf-8'))
44 playpath = 'mp4:' + real_id
46 video_filename = playpath.split('/')[-1]
47 video_id, extension = video_filename.split('.')
52 'description': video_description,
56 'play_path': playpath,