]>
 
 
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/escapist.py 
 
 
 
 
 
 
 
 
   1  from  __future__ 
import  unicode_literals
 
   3  from  . common 
import  InfoExtractor
 
  12  def  _decrypt_config ( key
,  string
):  
  17      while  len ( a
) < ( len ( string
) /  2 ):  
  20      a 
=  a
[ 0 : int ( len ( string
) /  2 )]  
  23      while  t 
<  len ( string
):  
  24          i 
+=  chr ( int ( string
[ t
] +  string
[ t 
+  1 ],  16 ))  
  29      for  t
,  c 
in  enumerate ( a
):  
  30          r 
+=  chr ( ord ( c
)  ^ 
ord ( icko
[ t
]))  
  35  class  EscapistIE ( InfoExtractor
):  
  36      _VALID_URL 
=  r
'https?://?(?:(?:www|v1)\.)?escapistmagazine\.com/videos/view/[^/]+/(?P<id>[0-9]+)'  
  38          'url' :  'http://www.escapistmagazine.com/videos/view/the-escapist-presents/6618-Breaking-Down-Baldurs-Gate' ,  
  39          'md5' :  'ab3a706c681efca53f0a35f1415cf0d1' ,  
  43              '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." ,  
  44              'title' :  "Breaking Down Baldur's Gate" ,  
  45              'thumbnail' :  r
're:^https?://.*\.jpg$' ,  
  47              'uploader' :  'The Escapist' ,  
  50          'url' :  'http://www.escapistmagazine.com/videos/view/zero-punctuation/10044-Evolve-One-vs-Multiplayer' ,  
  51          'md5' :  '9e8c437b0dbb0387d3bd3255ca77f6bf' ,  
  55              'description' :  'This week, Zero Punctuation reviews Evolve.' ,  
  56              'title' :  'Evolve - One vs Multiplayer' ,  
  57              'thumbnail' :  r
're:^https?://.*\.jpg$' ,  
  59              'uploader' :  'The Escapist' ,  
  62          'url' :  'http://escapistmagazine.com/videos/view/the-escapist-presents/6618' ,  
  63          'only_matching' :  True ,  
  65          'url' :  'https://v1.escapistmagazine.com/videos/view/the-escapist-presents/6618-Breaking-Down-Baldurs-Gate' ,  
  66          'only_matching' :  True ,  
  69      def  _real_extract ( self
,  url
):  
  70          video_id 
=  self
._ match
_ id
( url
)  
  71          webpage 
=  self
._ download
_ webpage
( url
,  video_id
)  
  73          ims_video 
=  self
._ parse
_ json
(  
  75                  r
'imsVideo\.play\(({.+?})\);' ,  webpage
,  'imsVideo' ),  
  77          video_id 
=  ims_video
[ 'videoID' ]  
  78          key 
=  ims_video
[ 'hash' ]  
  80          config 
=  self
._ download
_ webpage
(  
  81              'http://www.escapistmagazine.com/videos/vidconfig.php' ,  
  82              video_id
,  'Downloading video config' ,  headers
={  
  89          data 
=  self
._ parse
_ json
( _decrypt_config ( key
,  config
),  video_id
)  
  91          video_data 
=  data
[ 'videoData' ]  
  93          title 
=  clean_html ( video_data
[ 'title' ])  
  97              'format_id' :  ' %s-%s p'  % ( determine_ext ( video
[ 'src' ]),  video
[ 'res' ]),  
  98              'height' :  int_or_none ( video
. get ( 'res' )),  
  99          }  for  video 
in  data
[ 'files' ][ 'videos' ]]  
 100          self
._ sort
_ formats
( formats
)  
 106              'thumbnail' :  self
._ og
_ search
_ thumbnail
( webpage
)  or  data
. get ( 'poster' ),  
 107              'description' :  self
._ og
_ search
_ description
( webpage
),  
 108              'duration' :  float_or_none ( video_data
. get ( 'duration' ),  1000 ),  
 109              'uploader' :  video_data
. get ( 'publisher' ),  
 110              'series' :  video_data
. get ( 'show' ),