]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/escapist.py
1 from __future__
import unicode_literals
5 from . common
import InfoExtractor
13 class EscapistIE ( InfoExtractor
):
14 _VALID_URL
= r
'^https?://?(www\.)?escapistmagazine\.com/videos/view/(?P<showname>[^/]+)/(?P<id>[0-9]+)-'
16 'url' : 'http://www.escapistmagazine.com/videos/view/the-escapist-presents/6618-Breaking-Down-Baldurs-Gate' ,
17 'md5' : 'ab3a706c681efca53f0a35f1415cf0d1' ,
21 '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." ,
22 'uploader' : 'the-escapist-presents' ,
23 'title' : "Breaking Down Baldur's Gate" ,
27 def _real_extract ( self
, url
):
28 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
29 showName
= mobj
. group ( 'showname' )
30 video_id
= mobj
. group ( 'id' )
32 self
. report_extraction ( video_id
)
33 webpage
= self
._ download
_ webpage
( url
, video_id
)
35 videoDesc
= self
._ html
_ search
_ regex
(
36 r
'<meta name="description" content="([^"]*)"' ,
37 webpage
, 'description' , fatal
= False )
39 playerUrl
= self
._ og
_ search
_ video
_u rl
( webpage
, name
= 'player URL' )
41 title
= self
._ html
_ search
_ regex
(
42 r
'<meta name="title" content="([^"]*)"' ,
43 webpage
, 'title' ). split ( ' : ' )[- 1 ]
45 configUrl
= self
._ search
_ regex
( 'config=(.*)$' , playerUrl
, 'config URL' )
46 configUrl
= compat_urllib_parse
. unquote ( configUrl
)
50 def _add_format ( name
, cfgurl
, quality
):
51 config
= self
._ download
_ json
(
53 'Downloading ' + name
+ ' configuration' ,
54 'Unable to download ' + name
+ ' configuration' ,
55 transform_source
= lambda s
: s
. replace ( "'" , '"' ))
57 playlist
= config
[ 'playlist' ]
59 'url' : playlist
[ 1 ][ 'url' ],
64 _add_format ( 'normal' , configUrl
, quality
= 0 )
66 ( '&hq=1' if '?' in configUrl
else configUrl
+ '?hq=1' ))
68 _add_format ( 'hq' , hq_url
, quality
= 1 )
69 except ExtractorError
:
70 pass # That's fine, we'll just use normal quality
72 self
._ sort
_ formats
( formats
)
79 'thumbnail' : self
._ og
_ search
_ thumbnail
( webpage
),
80 'description' : videoDesc
,
81 'player_url' : playerUrl
,