]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/escapist.py
3aa2da52c0117bc9926df9c250eeb70da6cc2299
4 from . common
import InfoExtractor
13 class EscapistIE ( InfoExtractor
):
14 _VALID_URL
= r
'^(https?://)?(www\.)?escapistmagazine\.com/videos/view/(?P<showname>[^/]+)/(?P<episode>[^/?]+)[/?]?.*$'
16 u
'url' : u
'http://www.escapistmagazine.com/videos/view/the-escapist-presents/6618-Breaking-Down-Baldurs-Gate' ,
17 u
'file' : u
'6618-Breaking-Down-Baldurs-Gate.mp4' ,
18 u
'md5' : u
'c6793dbda81388f4264c1ba18684a74d' ,
20 u
"description" : u
"Baldur's Gate: Original, Modded or Enhanced Edition? I'll break down what you can expect from the new Baldur's Gate: Enhanced Edition." ,
21 u
"uploader" : u
"the-escapist-presents" ,
22 u
"title" : u
"Breaking Down Baldur's Gate"
26 def _real_extract ( self
, url
):
27 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
29 raise ExtractorError ( u
'Invalid URL: %s ' % url
)
30 showName
= mobj
. group ( 'showname' )
31 videoId
= mobj
. group ( 'episode' )
33 self
. report_extraction ( videoId
)
34 webpage
= self
._ download
_ webpage
( url
, videoId
)
36 videoDesc
= self
._ html
_ search
_ regex
( '<meta name="description" content="([^"]*)"' ,
37 webpage
, u
'description' , fatal
= False )
39 playerUrl
= self
._ og
_ search
_ video
_u rl
( webpage
, name
= 'player url' )
41 title
= self
._ html
_ search
_ regex
( '<meta name="title" content="([^"]*)"' ,
42 webpage
, u
'player url' ). split ( ' : ' )[- 1 ]
44 configUrl
= self
._ search
_ regex
( 'config=(.*)$' , playerUrl
, u
'config url' )
45 configUrl
= compat_urllib_parse
. unquote ( configUrl
)
47 configJSON
= self
._ download
_ webpage
( configUrl
, videoId
,
48 u
'Downloading configuration' ,
49 u
'unable to download configuration' )
51 # Technically, it's JavaScript, not JSON
52 configJSON
= configJSON
. replace ( "'" , '"' )
55 config
= json
. loads ( configJSON
)
56 except ( ValueError ,) as err
:
57 raise ExtractorError ( u
'Invalid JSON in configuration file: ' + compat_str ( err
))
59 playlist
= config
[ 'playlist' ]
60 videoUrl
= playlist
[ 1 ][ 'url' ]
69 'thumbnail' : self
._ og
_ search
_ thumbnail
( webpage
),
70 'description' : videoDesc
,
71 'player_url' : playerUrl
,