]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/turbo.py
7ae63a4992a74368ec8b5f6a266a298cb6776b79
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': '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
_URL
, url
)
33 video_id
= mobj
.group('id')
35 webpage
= self
._download
_webpage
(url
, video_id
)
37 playlist
= self
._download
_xml
(self
._API
_URL
.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
._html
_search
_meta
('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
,