]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/infoq.py
9056742821a2fd99fadd5b1271df7dc6f5127749
4 from .common
import InfoExtractor
12 class InfoQIE(InfoExtractor
):
13 _VALID_URL
= r
'^(?:https?://)?(?:www\.)?infoq\.com/[^/]+/[^/]+$'
15 def _real_extract(self
, url
):
16 mobj
= re
.match(self
._VALID
_URL
, url
)
18 webpage
= self
._download
_webpage
(url
, video_id
=url
)
19 self
.report_extraction(url
)
22 mobj
= re
.search(r
"jsclassref ?= ?'([^']*)'", webpage
)
24 raise ExtractorError(u
'Unable to extract video url')
25 real_id
= compat_urllib_parse
.unquote(base64
.b64decode(mobj
.group(1).encode('ascii')).decode('utf-8'))
26 video_url
= 'rtmpe://video.infoq.com/cfx/st/' + real_id
29 video_title
= self
._search
_regex
(r
'contentTitle = "(.*?)";',
33 video_description
= self
._html
_search
_regex
(r
'<meta name="description" content="(.*)"(?:\s*/)?>',
34 webpage
, u
'description', fatal
=False)
36 video_filename
= video_url
.split('/')[-1]
37 video_id
, extension
= video_filename
.split('.')
45 'ext': extension
, # Extension is always(?) mp4, but seems to be flv
47 'description': video_description
,