]>
 
 
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/jeuxvideo.py 
 
 
 
 
 
 
 
 
   3  from  __future__ 
import  unicode_literals
 
   8  from  . common 
import  InfoExtractor
 
  11  class  JeuxVideoIE ( InfoExtractor
):  
  12      _VALID_URL 
=  r
'http://.*?\.jeuxvideo\.com/.*/(.*?)-\d+\.htm'  
  15          'url' :  'http://www.jeuxvideo.com/reportages-videos-jeux/0004/00046170/tearaway-playstation-vita-gc-2013-tearaway-nous-presente-ses-papiers-d-identite-00115182.htm' ,  
  16          'md5' :  '046e491afb32a8aaac1f44dd4ddd54ee' ,  
  20              'title' :  'GC 2013 : Tearaway nous présente ses papiers d \' identité' ,  
  21              'description' :  'Lorsque les développeurs de LittleBigPlanet proposent un nouveau titre, on ne peut que s \' attendre à un résultat original et fort attrayant. \n ' ,  
  25      def  _real_extract ( self
,  url
):  
  26          mobj 
=  re
. match ( self
._ VALID
_U RL
,  url
)  
  28          webpage 
=  self
._ download
_ webpage
( url
,  title
)  
  29          xml_link 
=  self
._ html
_ search
_ regex
(  
  30              r
'<param name="flashvars" value="config=(.*?)" />' ,  
  31              webpage
,  'config URL' )  
  33          video_id 
=  self
._ search
_ regex
(  
  34              r
'http://www\.jeuxvideo\.com/config/\w+/\d+/(.*?)/\d+_player\.xml' ,  
  37          config 
=  self
._ download
_ xml
(  
  38              xml_link
,  title
,  'Downloading XML config' )  
  39          info_json 
=  config
. find ( 'format.json' ). text
 
  40          info 
=  json
. loads ( info_json
)[ 'versions' ][ 0 ]  
  42          video_url 
=  'http://video720.jeuxvideo.com/'  +  info
[ 'file' ]  
  46              'title' :  config
. find ( 'titre_video' ). text
,  
  49              'description' :  self
._ og
_ search
_ description
( webpage
),  
  50              'thumbnail' :  config
. find ( 'image' ). text
,