]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/slutload.py
New upstream version 2017.12.31
[youtubedl] / 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 _TESTS = [{
11 'url': 'http://www.slutload.com/video/virginie-baisee-en-cam/TD73btpBqSxc/',
12 'md5': '868309628ba00fd488cf516a113fd717',
13 'info_dict': {
14 'id': 'TD73btpBqSxc',
15 'ext': 'mp4',
16 'title': 'virginie baisee en cam',
17 'age_limit': 18,
18 'thumbnail': r're:https?://.*?\.jpg'
19 }
20 }, {
21 # mobile site
22 'url': 'http://mobile.slutload.com/video/masturbation-solo/fviFLmc6kzJ/',
23 'only_matching': True,
24 }]
25
26 def _real_extract(self, url):
27 video_id = self._match_id(url)
28
29 desktop_url = re.sub(r'^(https?://)mobile\.', r'\1', url)
30 webpage = self._download_webpage(desktop_url, video_id)
31
32 video_title = self._html_search_regex(r'<h1><strong>([^<]+)</strong>',
33 webpage, 'title').strip()
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 }