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