]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/escapist.py
1 from . common
import InfoExtractor
10 def _decrypt_config ( key
, string
):
15 while len ( a
) < ( len ( string
) / 2 ):
18 a
= a
[ 0 : int ( len ( string
) / 2 )]
21 while t
< len ( string
):
22 i
+= chr ( int ( string
[ t
] + string
[ t
+ 1 ], 16 ))
27 for t
, c
in enumerate ( a
):
28 r
+= chr ( ord ( c
) ^
ord ( icko
[ t
]))
33 class EscapistIE ( InfoExtractor
):
34 _VALID_URL
= r
'https?://?(?:(?:www|v1)\.)?escapistmagazine\.com/videos/view/[^/]+/(?P<id>[0-9]+)'
36 'url' : 'http://www.escapistmagazine.com/videos/view/the-escapist-presents/6618-Breaking-Down-Baldurs-Gate' ,
37 'md5' : 'ab3a706c681efca53f0a35f1415cf0d1' ,
41 '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." ,
42 'title' : "Breaking Down Baldur's Gate" ,
43 'thumbnail' : r
're:^https?://.*\.jpg$' ,
45 'uploader' : 'The Escapist' ,
48 'url' : 'http://www.escapistmagazine.com/videos/view/zero-punctuation/10044-Evolve-One-vs-Multiplayer' ,
49 'md5' : '9e8c437b0dbb0387d3bd3255ca77f6bf' ,
53 'description' : 'This week, Zero Punctuation reviews Evolve.' ,
54 'title' : 'Evolve - One vs Multiplayer' ,
55 'thumbnail' : r
're:^https?://.*\.jpg$' ,
57 'uploader' : 'The Escapist' ,
60 'url' : 'http://escapistmagazine.com/videos/view/the-escapist-presents/6618' ,
61 'only_matching' : True ,
63 'url' : 'https://v1.escapistmagazine.com/videos/view/the-escapist-presents/6618-Breaking-Down-Baldurs-Gate' ,
64 'only_matching' : True ,
67 def _real_extract ( self
, url
):
68 video_id
= self
._ match
_ id
( url
)
69 webpage
= self
._ download
_ webpage
( url
, video_id
)
71 ims_video
= self
._ parse
_ json
(
73 r
'imsVideo\.play\(( {.+?} )\);' , webpage
, 'imsVideo' ),
75 video_id
= ims_video
[ 'videoID' ]
76 key
= ims_video
[ 'hash' ]
78 config
= self
._ download
_ webpage
(
79 'http://www.escapistmagazine.com/videos/vidconfig.php' ,
80 video_id
, 'Downloading video config' , headers
={
87 data
= self
._ parse
_ json
( _decrypt_config ( key
, config
), video_id
)
89 video_data
= data
[ 'videoData' ]
91 title
= clean_html ( video_data
[ 'title' ])
95 'format_id' : ' %s-%s p' % ( determine_ext ( video
[ 'src' ]), video
[ 'res' ]),
96 'height' : int_or_none ( video
. get ( 'res' )),
97 } for video
in data
[ 'files' ][ 'videos' ]]
98 self
._ sort
_ formats
( formats
)
104 'thumbnail' : self
._ og
_ search
_ thumbnail
( webpage
) or data
. get ( 'poster' ),
105 'description' : self
._ og
_ search
_ description
( webpage
),
106 'duration' : float_or_none ( video_data
. get ( 'duration' ), 1000 ),
107 'uploader' : video_data
. get ( 'publisher' ),
108 'series' : video_data
. get ( 'show' ),