]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/trutube.py
Annotate changelog with (some) bugs closed.
[youtubedl] / youtube_dl / extractor / trutube.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4 from ..utils import xpath_text
5
6
7 class TruTubeIE(InfoExtractor):
8 _VALID_URL = r'https?://(?:www\.)?trutube\.tv/(?:video/|nuevo/player/embed\.php\?v=)(?P<id>[0-9]+)'
9 _TESTS = [{
10 'url': 'http://trutube.tv/video/14880/Ramses-II-Proven-To-Be-A-Red-Headed-Caucasoid-',
11 'md5': 'c5b6e301b0a2040b074746cbeaa26ca1',
12 'info_dict': {
13 'id': '14880',
14 'ext': 'flv',
15 'title': 'Ramses II - Proven To Be A Red Headed Caucasoid',
16 'thumbnail': 're:^http:.*\.jpg$',
17 }
18 }, {
19 'url': 'https://trutube.tv/nuevo/player/embed.php?v=14880',
20 'only_matching': True,
21 }]
22
23 def _real_extract(self, url):
24 video_id = self._match_id(url)
25
26 config = self._download_xml(
27 'https://trutube.tv/nuevo/player/config.php?v=%s' % video_id,
28 video_id, transform_source=lambda s: s.strip())
29
30 # filehd is always 404
31 video_url = xpath_text(config, './file', 'video URL', fatal=True)
32 title = xpath_text(config, './title', 'title').strip()
33 thumbnail = xpath_text(config, './image', ' thumbnail')
34
35 return {
36 'id': video_id,
37 'url': video_url,
38 'title': title,
39 'thumbnail': thumbnail,
40 }