Merge remote-tracking branch 'hojel/hentaistigma'
[youtube-dl] / youtube_dl / extractor / slutload.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6 from ..utils import (
7     ExtractorError,
8 )
9
10
11 class SlutloadIE(InfoExtractor):
12     _VALID_URL = r'^https?://(?:\w+\.)?slutload\.com/video/[^/]+/(?P<id>[^/]+)/?$'
13     _TEST = {
14         'url': 'http://www.slutload.com/video/virginie-baisee-en-cam/TD73btpBqSxc/',
15         'md5': '0cf531ae8006b530bd9df947a6a0df77',
16         'info_dict': {
17             'id': 'TD73btpBqSxc',
18             'ext': 'mp4',
19             "title": "virginie baisee en cam",
20             "age_limit": 18,
21             'thumbnail': 're:https?://.*?\.jpg'
22         }
23     }
24
25     def _real_extract(self, url):
26         mobj = re.match(self._VALID_URL, url)
27         video_id = mobj.group('id')
28
29         webpage = self._download_webpage(url, video_id)
30
31         video_title = self._html_search_regex(r'<h1><strong>([^<]+)</strong>',
32             webpage, 'title').strip()
33
34         video_url = self._html_search_regex(
35             r'(?s)<div id="vidPlayer"\s+data-url="([^"]+)"',
36             webpage, 'video URL')
37         thumbnail = self._html_search_regex(
38             r'(?s)<div id="vidPlayer"\s+.*?previewer-file="([^"]+)"',
39             webpage, 'thumbnail', fatal=False)
40
41         return {
42             'id': video_id,
43             'url': video_url,
44             'title': video_title,
45             'thumbnail': thumbnail,
46             'age_limit': 18
47         }