]>
Commit | Line | Data |
---|---|---|
db192b29 S |
1 | from __future__ import unicode_literals |
2 | ||
3 | from .common import InfoExtractor | |
41cff90c J |
4 | from ..utils import ( |
5 | parse_duration, | |
9868f1ab | 6 | urljoin, |
41cff90c | 7 | ) |
db192b29 S |
8 | |
9 | ||
10 | class YourPornIE(InfoExtractor): | |
8721b097 J |
11 | _VALID_URL = r'https?://(?:www\.)?(?:yourporn\.sexy|sxyprn\.com)/post/(?P<id>[^/?#&.]+)' |
12 | _TESTS = [{ | |
db192b29 S |
13 | 'url': 'https://yourporn.sexy/post/57ffcb2e1179b.html', |
14 | 'md5': '6f8682b6464033d87acaa7a8ff0c092e', | |
15 | 'info_dict': { | |
16 | 'id': '57ffcb2e1179b', | |
17 | 'ext': 'mp4', | |
18 | 'title': 'md5:c9f43630bd968267672651ba905a7d35', | |
19 | 'thumbnail': r're:^https?://.*\.jpg$', | |
9868f1ab S |
20 | 'duration': 165, |
21 | 'age_limit': 18, | |
22 | }, | |
23 | 'params': { | |
24 | 'skip_download': True, | |
db192b29 | 25 | }, |
8721b097 J |
26 | }, { |
27 | 'url': 'https://sxyprn.com/post/57ffcb2e1179b.html', | |
28 | 'only_matching': True, | |
29 | }] | |
db192b29 S |
30 | |
31 | def _real_extract(self, url): | |
32 | video_id = self._match_id(url) | |
33 | ||
34 | webpage = self._download_webpage(url, video_id) | |
35 | ||
36 | video_url = urljoin(url, self._parse_json( | |
37 | self._search_regex( | |
38 | r'data-vnfo=(["\'])(?P<data>{.+?})\1', webpage, 'data info', | |
39 | group='data'), | |
4e2491f0 | 40 | video_id)[video_id]).replace('/cdn/', '/cdn5/') |
db192b29 S |
41 | |
42 | title = (self._search_regex( | |
43 | r'<[^>]+\bclass=["\']PostEditTA[^>]+>([^<]+)', webpage, 'title', | |
44 | default=None) or self._og_search_description(webpage)).strip() | |
45 | thumbnail = self._og_search_thumbnail(webpage) | |
9868f1ab S |
46 | duration = parse_duration(self._search_regex( |
47 | r'duration\s*:\s*<[^>]+>([\d:]+)', webpage, 'duration', | |
48 | default=None)) | |
db192b29 S |
49 | |
50 | return { | |
51 | 'id': video_id, | |
52 | 'url': video_url, | |
53 | 'title': title, | |
54 | 'thumbnail': thumbnail, | |
9868f1ab S |
55 | 'duration': duration, |
56 | 'age_limit': 18, | |
db192b29 | 57 | } |