]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/slutload.py
Annotate some highlights of the release.
[youtubedl] / youtube_dl / extractor / slutload.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4
5
6 class SlutloadIE(InfoExtractor):
7 _VALID_URL = r'https?://(?:\w+\.)?slutload\.com/(?:video/[^/]+|embed_player|watch)/(?P<id>[^/]+)'
8 _TESTS = [{
9 'url': 'http://www.slutload.com/video/virginie-baisee-en-cam/TD73btpBqSxc/',
10 'md5': '868309628ba00fd488cf516a113fd717',
11 'info_dict': {
12 'id': 'TD73btpBqSxc',
13 'ext': 'mp4',
14 'title': 'virginie baisee en cam',
15 'age_limit': 18,
16 'thumbnail': r're:https?://.*?\.jpg'
17 },
18 }, {
19 # mobile site
20 'url': 'http://mobile.slutload.com/video/masturbation-solo/fviFLmc6kzJ/',
21 'only_matching': True,
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,
28 }]
29
30 def _real_extract(self, url):
31 video_id = self._match_id(url)
32
33 embed_page = self._download_webpage(
34 'http://www.slutload.com/embed_player/%s' % video_id, video_id,
35 'Downloading embed page', fatal=False)
36
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')
42
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 }
54
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({
61 'id': video_id,
62 'title': title,
63 'age_limit': 18,
64 })
65 return info