]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/turbo.py
29703a8a9a6ddf0981642c28cd2f1f68cc07c7b7
2 from __future__
import unicode_literals
6 from . common
import InfoExtractor
15 class TurboIE ( InfoExtractor
):
16 _VALID_URL
= r
'https?://(?:www\.)?turbo\.fr/videos-voiture/(?P<id>[0-9]+)-'
17 _API_URL
= 'http://www.turbo.fr/api/tv/xml.php?player_generique=player_generique&id= {0:} '
19 'url' : 'http://www.turbo.fr/videos-voiture/454443-turbo-du-07-09-2014-renault-twingo-3-bentley-continental-gt-speed-ces-guide-achat-dacia.html' ,
20 'md5' : '33f4b91099b36b5d5a91f84b5bcba600' ,
25 'title' : 'Turbo du 07/09/2014 : Renault Twingo 3, Bentley Continental GT Speed, CES, Guide Achat Dacia... ' ,
26 'description' : 'Retrouvez dans cette rubrique toutes les vidéos de l \' Turbo du 07/09/2014 : Renault Twingo 3, Bentley Continental GT Speed, CES, Guide Achat Dacia... ' ,
27 'thumbnail' : 're:^https?://.*\.jpg$' ,
31 def _real_extract ( self
, url
):
32 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
33 video_id
= mobj
. group ( 'id' )
35 webpage
= self
._ download
_ webpage
( url
, video_id
)
37 playlist
= self
._ download
_ xml
( self
._ API
_U RL
. format ( video_id
), video_id
)
38 item
= playlist
. find ( './channel/item' )
40 raise ExtractorError ( 'Playlist item was not found' , expected
= True )
42 title
= xpath_text ( item
, './title' , 'title' )
43 duration
= int_or_none ( xpath_text ( item
, './durate' , 'duration' ))
44 thumbnail
= xpath_text ( item
, './visuel_clip' , 'thumbnail' )
45 description
= self
._ og
_ search
_ description
( webpage
)
48 get_quality
= qualities ([ '3g' , 'sd' , 'hq' ])
50 m
= re
. search ( r
'url_video_(?P<quality>.+)' , child
. tag
)
52 quality
= m
. group ( 'quality' )
56 'quality' : get_quality ( quality
),
58 self
._ sort
_ formats
( formats
)
64 'thumbnail' : thumbnail
,
65 'description' : description
,