]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/turbo.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_str
16 class TurboIE(InfoExtractor
):
17 _VALID_URL
= r
'https?://(?:www\.)?turbo\.fr/videos-voiture/(?P<id>[0-9]+)-'
18 _API_URL
= 'http://www.turbo.fr/api/tv/xml.php?player_generique=player_generique&id={0:}'
20 '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',
21 'md5': '33f4b91099b36b5d5a91f84b5bcba600',
26 'title': 'Turbo du 07/09/2014 : Renault Twingo 3, Bentley Continental GT Speed, CES, Guide Achat Dacia... ',
27 'description': 'Turbo du 07/09/2014 : Renault Twingo 3, Bentley Continental GT Speed, CES, Guide Achat Dacia...',
28 'thumbnail': r
're:^https?://.*\.jpg$',
32 def _real_extract(self
, url
):
33 mobj
= re
.match(self
._VALID
_URL
, url
)
34 video_id
= mobj
.group('id')
36 webpage
= self
._download
_webpage
(url
, video_id
)
38 playlist
= self
._download
_xml
(self
._API
_URL
.format(video_id
), video_id
)
39 item
= playlist
.find('./channel/item')
41 raise ExtractorError('Playlist item was not found', expected
=True)
43 title
= xpath_text(item
, './title', 'title')
44 duration
= int_or_none(xpath_text(item
, './durate', 'duration'))
45 thumbnail
= xpath_text(item
, './visuel_clip', 'thumbnail')
46 description
= self
._html
_search
_meta
('description', webpage
)
49 get_quality
= qualities(['3g', 'sd', 'hq'])
51 m
= re
.search(r
'url_video_(?P<quality>.+)', child
.tag
)
53 quality
= compat_str(m
.group('quality'))
57 'quality': get_quality(quality
),
59 self
._sort
_formats
(formats
)
65 'thumbnail': thumbnail
,
66 'description': description
,