source: titan/mediathek/localhoster/lib/youtube_dl/extractor/spankbang.py @ 40094

Last change on this file since 40094 was 40094, checked in by obi, 7 years ago

tithek add yoztube-dl support

File size: 2.3 KB
Line 
1from __future__ import unicode_literals
2
3import re
4
5from .common import InfoExtractor
6
7
8class SpankBangIE(InfoExtractor):
9    _VALID_URL = r'https?://(?:(?:www|[a-z]{2})\.)?spankbang\.com/(?P<id>[\da-z]+)/video'
10    _TESTS = [{
11        'url': 'http://spankbang.com/3vvn/video/fantasy+solo',
12        'md5': '1cc433e1d6aa14bc376535b8679302f7',
13        'info_dict': {
14            'id': '3vvn',
15            'ext': 'mp4',
16            'title': 'fantasy solo',
17            'description': 'Watch fantasy solo free HD porn video - 05 minutes - dillion harper masturbates on a bed free adult movies.',
18            'thumbnail': r're:^https?://.*\.jpg$',
19            'uploader': 'silly2587',
20            'age_limit': 18,
21        }
22    }, {
23        # 480p only
24        'url': 'http://spankbang.com/1vt0/video/solvane+gangbang',
25        'only_matching': True,
26    }, {
27        # no uploader
28        'url': 'http://spankbang.com/lklg/video/sex+with+anyone+wedding+edition+2',
29        'only_matching': True,
30    }]
31
32    def _real_extract(self, url):
33        video_id = self._match_id(url)
34        webpage = self._download_webpage(url, video_id)
35
36        stream_key = self._html_search_regex(
37            r'''var\s+stream_key\s*=\s*['"](.+?)['"]''',
38            webpage, 'stream key')
39
40        formats = [{
41            'url': 'http://spankbang.com/_%s/%s/title/%sp__mp4' % (video_id, stream_key, height),
42            'ext': 'mp4',
43            'format_id': '%sp' % height,
44            'height': int(height),
45        } for height in re.findall(r'<(?:span|li|p)[^>]+[qb]_(\d+)p', webpage)]
46        self._check_formats(formats, video_id)
47        self._sort_formats(formats)
48
49        title = self._html_search_regex(
50            r'(?s)<h1[^>]*>(.+?)</h1>', webpage, 'title')
51        description = self._og_search_description(webpage)
52        thumbnail = self._og_search_thumbnail(webpage)
53        uploader = self._search_regex(
54            r'class="user"[^>]*><img[^>]+>([^<]+)',
55            webpage, 'uploader', default=None)
56
57        age_limit = self._rta_search(webpage)
58
59        return {
60            'id': video_id,
61            'title': title,
62            'description': description,
63            'thumbnail': thumbnail,
64            'uploader': uploader,
65            'formats': formats,
66            'age_limit': age_limit,
67        }
Note: See TracBrowser for help on using the repository browser.