]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/turbo.py
3 from .common
import InfoExtractor
4 from ..compat
import compat_str
13 class TurboIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?turbo\.fr/videos-voiture/(?P<id>[0-9]+)-'
15 _API_URL
= 'http://www.turbo.fr/api/tv/xml.php?player_generique=player_generique&id={0:}'
17 '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',
18 'md5': '33f4b91099b36b5d5a91f84b5bcba600',
23 'title': 'Turbo du 07/09/2014 : Renault Twingo 3, Bentley Continental GT Speed, CES, Guide Achat Dacia... ',
24 'description': 'Turbo du 07/09/2014 : Renault Twingo 3, Bentley Continental GT Speed, CES, Guide Achat Dacia...',
25 'thumbnail': r
're:^https?://.*\.jpg$',
29 def _real_extract(self
, url
):
30 mobj
= self
._match
_valid
_url
(url
)
31 video_id
= mobj
.group('id')
33 webpage
= self
._download
_webpage
(url
, video_id
)
35 playlist
= self
._download
_xml
(self
._API
_URL
.format(video_id
), video_id
)
36 item
= playlist
.find('./channel/item')
38 raise ExtractorError('Playlist item was not found', expected
=True)
40 title
= xpath_text(item
, './title', 'title')
41 duration
= int_or_none(xpath_text(item
, './durate', 'duration'))
42 thumbnail
= xpath_text(item
, './visuel_clip', 'thumbnail')
43 description
= self
._html
_search
_meta
('description', webpage
)
46 get_quality
= qualities(['3g', 'sd', 'hq'])
48 m
= re
.search(r
'url_video_(?P<quality>.+)', child
.tag
)
50 quality
= compat_str(m
.group('quality'))
54 'quality': get_quality(quality
),
61 'thumbnail': thumbnail
,
62 'description': description
,