]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/extremetube.py
debian/changelog: Wrap long line.
[youtubedl] / youtube_dl / extractor / extremetube.py
1 from __future__ import unicode_literals
2
3 from ..utils import str_to_int
4 from .keezmovies import KeezMoviesIE
5
6
7 class ExtremeTubeIE(KeezMoviesIE):
8 _VALID_URL = r'https?://(?:www\.)?extremetube\.com/(?:[^/]+/)?video/(?P<id>[^/#?&]+)'
9 _TESTS = [{
10 'url': 'http://www.extremetube.com/video/music-video-14-british-euro-brit-european-cumshots-swallow-652431',
11 'md5': '92feaafa4b58e82f261e5419f39c60cb',
12 'info_dict': {
13 'id': 'music-video-14-british-euro-brit-european-cumshots-swallow-652431',
14 'ext': 'mp4',
15 'title': 'Music Video 14 british euro brit european cumshots swallow',
16 'uploader': 'anonim',
17 'view_count': int,
18 'age_limit': 18,
19 }
20 }, {
21 'url': 'http://www.extremetube.com/gay/video/abcde-1234',
22 'only_matching': True,
23 }, {
24 'url': 'http://www.extremetube.com/video/latina-slut-fucked-by-fat-black-dick',
25 'only_matching': True,
26 }, {
27 'url': 'http://www.extremetube.com/video/652431',
28 'only_matching': True,
29 }]
30
31 def _real_extract(self, url):
32 webpage, info = self._extract_info(url)
33
34 if not info['title']:
35 info['title'] = self._search_regex(
36 r'<h1[^>]+title="([^"]+)"[^>]*>', webpage, 'title')
37
38 uploader = self._html_search_regex(
39 r'Uploaded by:\s*</[^>]+>\s*<a[^>]+>(.+?)</a>',
40 webpage, 'uploader', fatal=False)
41 view_count = str_to_int(self._search_regex(
42 r'Views:\s*</[^>]+>\s*<[^>]+>([\d,\.]+)</',
43 webpage, 'view count', fatal=False))
44
45 info.update({
46 'uploader': uploader,
47 'view_count': view_count,
48 })
49
50 return info