]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/infoq.py
1 from __future__
import unicode_literals
5 from . common
import InfoExtractor
12 class InfoQIE ( InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?infoq\.com/(?:[^/]+/)+(?P<id>[^/]+)'
16 'url' : 'http://www.infoq.com/presentations/A-Few-of-My-Favorite-Python-Things' ,
17 'md5' : 'b5ca0e0a8c1fed93b0e65e48e462f9a2' ,
19 'id' : '12-jan-pythonthings' ,
21 'description' : 'Mike Pirnat presents some tips and tricks, standard libraries and third party packages that make programming in Python a richer experience.' ,
22 'title' : 'A Few of My Favorite [Python] Things' ,
25 'url' : 'http://www.infoq.com/fr/presentations/changez-avis-sur-javascript' ,
26 'only_matching' : True ,
29 def _real_extract ( self
, url
):
30 video_id
= self
._ match
_ id
( url
)
31 webpage
= self
._ download
_ webpage
( url
, video_id
)
33 video_title
= self
._ html
_ search
_ regex
( r
'<title>(.*?)</title>' , webpage
, 'title' )
34 video_description
= self
._ html
_ search
_ meta
( 'description' , webpage
, 'description' )
36 # The server URL is hardcoded
37 video_url
= 'rtmpe://video.infoq.com/cfx/st/'
40 encoded_id
= self
._ search
_ regex
(
41 r
"jsclassref\s*=\s*'([^']*)'" , webpage
, 'encoded id' )
42 real_id
= compat_urllib_parse
. unquote ( base64
. b64decode ( encoded_id
. encode ( 'ascii' )). decode ( 'utf-8' ))
43 playpath
= 'mp4:' + real_id
45 video_filename
= playpath
. split ( '/' )[- 1 ]
46 video_id
, extension
= video_filename
. split ( '.' )
48 http_base
= self
._ search
_ regex
(
49 r
'EXPRESSINSTALL_SWF\s*=\s*[^"]*"((?:https?:)?//[^/"]+/)' , webpage
,
56 'play_path' : playpath
,
59 'url' : compat_urlparse
. urljoin ( url
, http_base
) + real_id
,
61 self
._ sort
_ formats
( formats
)
66 'description' : video_description
,