]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/escapist.py
e240cb8591ecc467c44d98742685740f4354cbda
1 from __future__
import unicode_literals
5 from . common
import InfoExtractor
14 class EscapistIE ( InfoExtractor
):
15 _VALID_URL
= r
'^https?://?(www\.)?escapistmagazine\.com/videos/view/(?P<showname>[^/]+)/(?P<id>[0-9]+)-'
17 'url' : 'http://www.escapistmagazine.com/videos/view/the-escapist-presents/6618-Breaking-Down-Baldurs-Gate' ,
18 'md5' : 'ab3a706c681efca53f0a35f1415cf0d1' ,
22 'description' : "Baldur's Gate: Original, Modded or Enhanced Edition? I'll break down what you can expect from the new Baldur's Gate: Enhanced Edition." ,
23 'uploader' : 'the-escapist-presents' ,
24 'title' : "Breaking Down Baldur's Gate" ,
28 def _real_extract ( self
, url
):
29 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
30 showName
= mobj
. group ( 'showname' )
31 video_id
= mobj
. group ( 'id' )
33 self
. report_extraction ( video_id
)
34 webpage
= self
._ download
_ webpage
( url
, video_id
)
36 videoDesc
= self
._ html
_ search
_ regex
(
37 r
'<meta name="description" content="([^"]*)"' ,
38 webpage
, 'description' , fatal
= False )
40 playerUrl
= self
._ og
_ search
_ video
_u rl
( webpage
, name
= 'player URL' )
42 title
= self
._ html
_ search
_ regex
(
43 r
'<meta name="title" content="([^"]*)"' ,
44 webpage
, 'title' ). split ( ' : ' )[- 1 ]
46 configUrl
= self
._ search
_ regex
( 'config=(.*)$' , playerUrl
, 'config URL' )
47 configUrl
= compat_urllib_parse
. unquote ( configUrl
)
51 def _add_format ( name
, cfgurl
, quality
):
52 config
= self
._ download
_ json
(
54 'Downloading ' + name
+ ' configuration' ,
55 'Unable to download ' + name
+ ' configuration' ,
56 transform_source
= lambda s
: s
. replace ( "'" , '"' ))
58 playlist
= config
[ 'playlist' ]
60 'url' : playlist
[ 1 ][ 'url' ],
65 _add_format ( 'normal' , configUrl
, quality
= 0 )
67 ( '&hq=1' if '?' in configUrl
else configUrl
+ '?hq=1' ))
69 _add_format ( 'hq' , hq_url
, quality
= 1 )
70 except ExtractorError
:
71 pass # That's fine, we'll just use normal quality
73 self
._ sort
_ formats
( formats
)
80 'thumbnail' : self
._ og
_ search
_ thumbnail
( webpage
),
81 'description' : videoDesc
,
82 'player_url' : playerUrl
,