]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/jeuxvideo.py
5 import xml
. etree
. ElementTree
7 from . common
import InfoExtractor
9 class JeuxVideoIE ( InfoExtractor
):
10 _VALID_URL
= r
'http://.*?\.jeuxvideo\.com/.*/(.*?)-\d+\.htm'
13 u
'url' : u
'http://www.jeuxvideo.com/reportages-videos-jeux/0004/00046170/tearaway-playstation-vita-gc-2013-tearaway-nous-presente-ses-papiers-d-identite-00115182.htm' ,
15 u
'md5' : u
'e0fdb0cd3ce98713ef9c1e1e025779d0' ,
17 u
'title' : u
'GC 2013 : Tearaway nous présente ses papiers d \' identité' ,
18 u
'description' : u
'Lorsque les développeurs de LittleBigPlanet proposent un nouveau titre, on ne peut que s \' attendre à un résultat original et fort attrayant. \n ' ,
22 def _real_extract ( self
, url
):
23 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
24 title
= re
. match ( self
._ VALID
_U RL
, url
). group ( 1 )
25 webpage
= self
._ download
_ webpage
( url
, title
)
26 m_download
= re
. search ( r
'<param name="flashvars" value="config=(.*?)" />' , webpage
)
28 xml_link
= m_download
. group ( 1 )
30 id = re
. search ( r
'http://www.jeuxvideo.com/config/\w+/0011/(.*?)/\d+_player\.xml' , xml_link
). group ( 1 )
32 xml_config
= self
._ download
_ webpage
( xml_link
, title
,
33 'Downloading XML config' )
34 config
= xml
. etree
. ElementTree
. fromstring ( xml_config
. encode ( 'utf-8' ))
35 info
= re
. search ( r
'<format\.json>(.*?)</format\.json>' ,
36 xml_config
, re
. MULTILINE|re
. DOTALL
). group ( 1 )
37 info
= json
. loads ( info
)[ 'versions' ][ 0 ]
39 video_url
= 'http://video720.jeuxvideo.com/' + info
[ 'file' ]
42 'title' : config
. find ( 'titre_video' ). text
,
45 'description' : self
._ og
_ search
_ description
( webpage
),
46 'thumbnail' : config
. find ( 'image' ). text
,