]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/slutload.py
[tvnet] Improve video id extraction
[yt-dlp.git] / youtube_dl / extractor / slutload.py
CommitLineData
5301304b
PH
1from __future__ import unicode_literals
2
4f5cf319
W
3import re
4
1476b497 5from .common import InfoExtractor
1476b497 6
5301304b 7
1476b497 8class SlutloadIE(InfoExtractor):
5301304b 9 _VALID_URL = r'^https?://(?:\w+\.)?slutload\.com/video/[^/]+/(?P<id>[^/]+)/?$'
4f5cf319 10 _TESTS = [{
5301304b 11 'url': 'http://www.slutload.com/video/virginie-baisee-en-cam/TD73btpBqSxc/',
2b51dac1 12 'md5': '868309628ba00fd488cf516a113fd717',
5301304b
PH
13 'info_dict': {
14 'id': 'TD73btpBqSxc',
15 'ext': 'mp4',
611c1dd9
S
16 'title': 'virginie baisee en cam',
17 'age_limit': 18,
ec85ded8 18 'thumbnail': r're:https?://.*?\.jpg'
1476b497 19 }
4f5cf319
W
20 }, {
21 # mobile site
22 'url': 'http://mobile.slutload.com/video/masturbation-solo/fviFLmc6kzJ/',
23 'only_matching': True,
24 }]
1476b497 25
26 def _real_extract(self, url):
2b51dac1 27 video_id = self._match_id(url)
4f5cf319
W
28
29 desktop_url = re.sub(r'^(https?://)mobile\.', r'\1', url)
30 webpage = self._download_webpage(desktop_url, video_id)
1476b497 31
1476b497 32 video_title = self._html_search_regex(r'<h1><strong>([^<]+)</strong>',
9e1a5b84 33 webpage, 'title').strip()
5301304b
PH
34
35 video_url = self._html_search_regex(
36 r'(?s)<div id="vidPlayer"\s+data-url="([^"]+)"',
37 webpage, 'video URL')
38 thumbnail = self._html_search_regex(
39 r'(?s)<div id="vidPlayer"\s+.*?previewer-file="([^"]+)"',
40 webpage, 'thumbnail', fatal=False)
41
42 return {
43 'id': video_id,
44 'url': video_url,
45 'title': video_title,
46 'thumbnail': thumbnail,
47 'age_limit': 18
48 }