[nuevo] Generalize nuevo extractor and add support for trollvids
[youtube-dl] / youtube_dl / extractor / trutube.py
1 from __future__ import unicode_literals
2
3 from .nuevo import NuevoBaseIE
4
5
6 class TruTubeIE(NuevoBaseIE):
7     _VALID_URL = r'https?://(?:www\.)?trutube\.tv/(?:video/|nuevo/player/embed\.php\?v=)(?P<id>[0-9]+)'
8     _TESTS = [{
9         'url': 'http://trutube.tv/video/14880/Ramses-II-Proven-To-Be-A-Red-Headed-Caucasoid-',
10         'md5': 'c5b6e301b0a2040b074746cbeaa26ca1',
11         'info_dict': {
12             'id': '14880',
13             'ext': 'flv',
14             'title': 'Ramses II - Proven To Be A Red Headed Caucasoid',
15             'thumbnail': 're:^http:.*\.jpg$',
16         }
17     }, {
18         'url': 'https://trutube.tv/nuevo/player/embed.php?v=14880',
19         'only_matching': True,
20     }]
21
22     def _real_extract(self, url):
23         video_id = self._match_id(url)
24         config_url = 'https://trutube.tv/nuevo/player/config.php?v=%s' % video_id
25
26         info = self._extract_nuevo(config_url, video_id)
27
28         # filehd always 404s
29         info['formats'] = info['formats'][:1]
30
31         return info