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