]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/infoq.py
1 from __future__
import unicode_literals
6 from . common
import InfoExtractor
12 class InfoQIE ( InfoExtractor
):
13 _VALID_URL
= r
'^(?:https?://)?(?:www\.)?infoq\.com/[^/]+/[^/]+$'
16 "url" : "http://www.infoq.com/presentations/A-Few-of-My-Favorite-Python-Things" ,
17 "file" : "12-jan-pythonthings.mp4" ,
19 "description" : "Mike Pirnat presents some tips and tricks, standard libraries and third party packages that make programming in Python a richer experience." ,
20 "title" : "A Few of My Favorite [Python] Things" ,
23 "skip_download" : True ,
27 def _real_extract ( self
, url
):
28 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
30 webpage
= self
._ download
_ webpage
( url
, video_id
= url
)
31 self
. report_extraction ( url
)
34 encoded_id
= self
._ search
_ regex
( r
"jsclassref ?= ?'([^']*)'" , webpage
, 'encoded id' )
35 real_id
= compat_urllib_parse
. unquote ( base64
. b64decode ( encoded_id
. encode ( 'ascii' )). decode ( 'utf-8' ))
36 video_url
= 'rtmpe://video.infoq.com/cfx/st/' + real_id
39 video_title
= self
._ search
_ regex
( r
'contentTitle = "(.*?)";' ,
43 video_description
= self
._ html
_ search
_ regex
( r
'<meta name="description" content="(.*)"(?:\s*/)?>' ,
44 webpage
, 'description' , fatal
= False )
46 video_filename
= video_url
. split ( '/' )[- 1 ]
47 video_id
, extension
= video_filename
. split ( '.' )
53 'ext' : extension
, # Extension is always(?) mp4, but seems to be flv
54 'description' : video_description
,