]>
Commit | Line | Data |
---|---|---|
491ed3dd PH |
1 | from __future__ import unicode_literals |
2 | ||
9ddfd84e | 3 | from .common import InfoExtractor |
c451d4f5 | 4 | from ..utils import xpath_text |
9ddfd84e JMS |
5 | |
6 | ||
7 | class TruTubeIE(InfoExtractor): | |
c451d4f5 S |
8 | _VALID_URL = r'https?://(?:www\.)?trutube\.tv/(?:video/|nuevo/player/embed\.php\?v=)(?P<id>[0-9]+)' |
9 | _TESTS = [{ | |
491ed3dd PH |
10 | 'url': 'http://trutube.tv/video/14880/Ramses-II-Proven-To-Be-A-Red-Headed-Caucasoid-', |
11 | 'md5': 'c5b6e301b0a2040b074746cbeaa26ca1', | |
9ddfd84e | 12 | 'info_dict': { |
491ed3dd PH |
13 | 'id': '14880', |
14 | 'ext': 'flv', | |
15 | 'title': 'Ramses II - Proven To Be A Red Headed Caucasoid', | |
16 | 'thumbnail': 're:^http:.*\.jpg$', | |
9ddfd84e | 17 | } |
c451d4f5 S |
18 | }, { |
19 | 'url': 'https://trutube.tv/nuevo/player/embed.php?v=14880', | |
20 | 'only_matching': True, | |
21 | }] | |
9ddfd84e JMS |
22 | |
23 | def _real_extract(self, url): | |
c451d4f5 | 24 | video_id = self._match_id(url) |
9ddfd84e | 25 | |
c451d4f5 S |
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()) | |
491ed3dd | 29 | |
c451d4f5 S |
30 | # filehd is always 404 |
31 | video_url = xpath_text(config, './file', 'video URL', fatal=True) | |
fdca55fe | 32 | title = xpath_text(config, './title', 'title').strip() |
c451d4f5 | 33 | thumbnail = xpath_text(config, './image', ' thumbnail') |
9ddfd84e JMS |
34 | |
35 | return { | |
36 | 'id': video_id, | |
c451d4f5 S |
37 | 'url': video_url, |
38 | 'title': title, | |
491ed3dd PH |
39 | 'thumbnail': thumbnail, |
40 | } |