]>
Commit | Line | Data |
---|---|---|
4e7b5bba | 1 | from .common import InfoExtractor |
6be17c08 S |
2 | from ..utils import ( |
3 | int_or_none, | |
4 | str_to_int, | |
5 | unified_strdate, | |
77ae6587 | 6 | ) |
6be17c08 | 7 | from .keezmovies import KeezMoviesIE |
77ae6587 | 8 | |
191b7cbb | 9 | |
6368e2e6 | 10 | class MofosexIE(KeezMoviesIE): # XXX: Do not subclass from concrete IE |
6be17c08 S |
11 | _VALID_URL = r'https?://(?:www\.)?mofosex\.com/videos/(?P<id>\d+)/(?P<display_id>[^/?#&.]+)\.html' |
12 | _TESTS = [{ | |
13 | 'url': 'http://www.mofosex.com/videos/318131/amateur-teen-playing-and-masturbating-318131.html', | |
c1942002 | 14 | 'md5': '558fcdafbb63a87c019218d6e49daf8a', |
191b7cbb | 15 | 'info_dict': { |
6be17c08 S |
16 | 'id': '318131', |
17 | 'display_id': 'amateur-teen-playing-and-masturbating-318131', | |
191b7cbb | 18 | 'ext': 'mp4', |
6be17c08 | 19 | 'title': 'amateur teen playing and masturbating', |
ec85ded8 | 20 | 'thumbnail': r're:^https?://.*\.jpg$', |
6be17c08 S |
21 | 'upload_date': '20121114', |
22 | 'view_count': int, | |
23 | 'like_count': int, | |
24 | 'dislike_count': int, | |
191b7cbb | 25 | 'age_limit': 18, |
77ae6587 | 26 | } |
6be17c08 S |
27 | }, { |
28 | # This video is no longer available | |
29 | 'url': 'http://www.mofosex.com/videos/5018/japanese-teen-music-video.html', | |
30 | 'only_matching': True, | |
31 | }] | |
77ae6587 | 32 | |
33 | def _real_extract(self, url): | |
6be17c08 S |
34 | webpage, info = self._extract_info(url) |
35 | ||
36 | view_count = str_to_int(self._search_regex( | |
37 | r'VIEWS:</span>\s*([\d,.]+)', webpage, 'view count', fatal=False)) | |
38 | like_count = int_or_none(self._search_regex( | |
39 | r'id=["\']amountLikes["\'][^>]*>(\d+)', webpage, | |
40 | 'like count', fatal=False)) | |
41 | dislike_count = int_or_none(self._search_regex( | |
42 | r'id=["\']amountDislikes["\'][^>]*>(\d+)', webpage, | |
43 | 'like count', fatal=False)) | |
44 | upload_date = unified_strdate(self._html_search_regex( | |
45 | r'Added:</span>([^<]+)', webpage, 'upload date', fatal=False)) | |
46 | ||
47 | info.update({ | |
48 | 'view_count': view_count, | |
49 | 'like_count': like_count, | |
50 | 'dislike_count': dislike_count, | |
51 | 'upload_date': upload_date, | |
52 | 'thumbnail': self._og_search_thumbnail(webpage), | |
53 | }) | |
54 | ||
55 | return info | |
4e7b5bba S |
56 | |
57 | ||
58 | class MofosexEmbedIE(InfoExtractor): | |
59 | _VALID_URL = r'https?://(?:www\.)?mofosex\.com/embed/?\?.*?\bvideoid=(?P<id>\d+)' | |
bfd973ec | 60 | _EMBED_REGEX = [r'<iframe[^>]+\bsrc=["\'](?P<url>(?:https?:)?//(?:www\.)?mofosex\.com/embed/?\?.*?\bvideoid=\d+)'] |
4e7b5bba S |
61 | _TESTS = [{ |
62 | 'url': 'https://www.mofosex.com/embed/?videoid=318131&referrer=KM', | |
63 | 'only_matching': True, | |
64 | }] | |
65 | ||
4e7b5bba S |
66 | def _real_extract(self, url): |
67 | video_id = self._match_id(url) | |
68 | return self.url_result( | |
69 | 'http://www.mofosex.com/videos/{0}/{0}.html'.format(video_id), | |
70 | ie=MofosexIE.ie_key(), video_id=video_id) |