]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/slutload.py
[ie/matchtv] Fix extractor (#10190)
[yt-dlp.git] / yt_dlp / extractor / slutload.py
CommitLineData
1476b497 1from .common import InfoExtractor
1476b497 2
5301304b 3
1476b497 4class SlutloadIE(InfoExtractor):
c63f5fb8 5 _VALID_URL = r'https?://(?:\w+\.)?slutload\.com/(?:video/[^/]+|embed_player|watch)/(?P<id>[^/]+)'
4f5cf319 6 _TESTS = [{
5301304b 7 'url': 'http://www.slutload.com/video/virginie-baisee-en-cam/TD73btpBqSxc/',
2b51dac1 8 'md5': '868309628ba00fd488cf516a113fd717',
5301304b
PH
9 'info_dict': {
10 'id': 'TD73btpBqSxc',
11 'ext': 'mp4',
611c1dd9
S
12 'title': 'virginie baisee en cam',
13 'age_limit': 18,
add96eb9 14 'thumbnail': r're:https?://.*?\.jpg',
c63f5fb8 15 },
4f5cf319
W
16 }, {
17 # mobile site
18 'url': 'http://mobile.slutload.com/video/masturbation-solo/fviFLmc6kzJ/',
19 'only_matching': True,
c63f5fb8
S
20 }, {
21 'url': 'http://www.slutload.com/embed_player/TD73btpBqSxc/',
22 'only_matching': True,
23 }, {
24 'url': 'http://www.slutload.com/watch/TD73btpBqSxc/Virginie-Baisee-En-Cam.html',
25 'only_matching': True,
4f5cf319 26 }]
1476b497 27
28 def _real_extract(self, url):
2b51dac1 29 video_id = self._match_id(url)
4f5cf319 30
c63f5fb8 31 embed_page = self._download_webpage(
add96eb9 32 f'http://www.slutload.com/embed_player/{video_id}', video_id,
c63f5fb8 33 'Downloading embed page', fatal=False)
1476b497 34
c63f5fb8
S
35 if embed_page:
36 def extract(what):
37 return self._html_search_regex(
add96eb9 38 rf'data-video-{what}=(["\'])(?P<url>(?:(?!\1).)+)\1',
39 embed_page, f'video {what}', default=None, group='url')
5301304b 40
c63f5fb8
S
41 video_url = extract('url')
42 if video_url:
43 title = self._html_search_regex(
44 r'<title>([^<]+)', embed_page, 'title', default=video_id)
45 return {
46 'id': video_id,
47 'url': video_url,
48 'title': title,
49 'thumbnail': extract('preview'),
add96eb9 50 'age_limit': 18,
c63f5fb8 51 }
5301304b 52
c63f5fb8 53 webpage = self._download_webpage(
add96eb9 54 f'http://www.slutload.com/video/_/{video_id}/', video_id)
c63f5fb8
S
55 title = self._html_search_regex(
56 r'<h1><strong>([^<]+)</strong>', webpage, 'title').strip()
57 info = self._parse_html5_media_entries(url, webpage, video_id)[0]
58 info.update({
5301304b 59 'id': video_id,
c63f5fb8
S
60 'title': title,
61 'age_limit': 18,
62 })
63 return info