]> git.bitcoin.ninja Git - youtube-dl/blob - youtube_dl/extractor/ruleporn.py
[tvland] Extend _VALID_URL (Closes #10812)
[youtube-dl] / youtube_dl / extractor / ruleporn.py
1 from __future__ import unicode_literals
2
3 from .nuevo import NuevoBaseIE
4
5
6 class RulePornIE(NuevoBaseIE):
7     _VALID_URL = r'https?://(?:www\.)?ruleporn\.com/(?:[^/?#&]+/)*(?P<id>[^/?#&]+)'
8     _TEST = {
9         'url': 'http://ruleporn.com/brunette-nympho-chick-takes-her-boyfriend-in-every-angle/',
10         'md5': '86861ebc624a1097c7c10eaf06d7d505',
11         'info_dict': {
12             'id': '48212',
13             'display_id': 'brunette-nympho-chick-takes-her-boyfriend-in-every-angle',
14             'ext': 'mp4',
15             'title': 'Brunette Nympho Chick Takes Her Boyfriend In Every Angle',
16             'description': 'md5:6d28be231b981fff1981deaaa03a04d5',
17             'age_limit': 18,
18             'duration': 635.1,
19         }
20     }
21
22     def _real_extract(self, url):
23         display_id = self._match_id(url)
24
25         webpage = self._download_webpage(url, display_id)
26
27         video_id = self._search_regex(
28             r'lovehomeporn\.com/embed/(\d+)', webpage, 'video id')
29
30         title = self._search_regex(
31             r'<h2[^>]+title=(["\'])(?P<url>.+?)\1',
32             webpage, 'title', group='url')
33         description = self._html_search_meta('description', webpage)
34
35         info = self._extract_nuevo(
36             'http://lovehomeporn.com/media/nuevo/econfig.php?key=%s&rp=true' % video_id,
37             video_id)
38         info.update({
39             'display_id': display_id,
40             'title': title,
41             'description': description,
42             'age_limit': 18
43         })
44         return info