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