4 from .common
import InfoExtractor
12 class InfoQIE(InfoExtractor
):
13 _VALID_URL
= r
'^(?:https?://)?(?:www\.)?infoq\.com/[^/]+/[^/]+$'
16 u
"url": u
"http://www.infoq.com/presentations/A-Few-of-My-Favorite-Python-Things",
17 u
"file": u
"12-jan-pythonthings.mp4",
19 u
"description": u
"Mike Pirnat presents some tips and tricks, standard libraries and third party packages that make programming in Python a richer experience.",
20 u
"title": u
"A Few of My Favorite [Python] Things"
23 u
"skip_download": True
27 def _real_extract(self
, url
):
28 mobj
= re
.match(self
._VALID
_URL
, url
)
30 webpage
= self
._download
_webpage
(url
, video_id
=url
)
31 self
.report_extraction(url
)
34 mobj
= re
.search(r
"jsclassref ?= ?'([^']*)'", webpage
)
36 raise ExtractorError(u
'Unable to extract video url')
37 real_id
= compat_urllib_parse
.unquote(base64
.b64decode(mobj
.group(1).encode('ascii')).decode('utf-8'))
38 video_url
= 'rtmpe://video.infoq.com/cfx/st/' + real_id
41 video_title
= self
._search
_regex
(r
'contentTitle = "(.*?)";',
45 video_description
= self
._html
_search
_regex
(r
'<meta name="description" content="(.*)"(?:\s*/)?>',
46 webpage
, u
'description', fatal
=False)
48 video_filename
= video_url
.split('/')[-1]
49 video_id
, extension
= video_filename
.split('.')
57 'ext': extension
, # Extension is always(?) mp4, but seems to be flv
59 'description': video_description
,