]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/mofosex.py
Revert "pull changes from remote master (#190)" (#193)
[yt-dlp.git] / youtube_dl / extractor / mofosex.py
CommitLineData
191b7cbb
PH
1from __future__ import unicode_literals
2
6be17c08
S
3from ..utils import (
4 int_or_none,
5 str_to_int,
6 unified_strdate,
77ae6587 7)
6be17c08 8from .keezmovies import KeezMoviesIE
77ae6587 9
191b7cbb 10
6be17c08
S
11class MofosexIE(KeezMoviesIE):
12 _VALID_URL = r'https?://(?:www\.)?mofosex\.com/videos/(?P<id>\d+)/(?P<display_id>[^/?#&.]+)\.html'
13 _TESTS = [{
14 'url': 'http://www.mofosex.com/videos/318131/amateur-teen-playing-and-masturbating-318131.html',
c1942002 15 'md5': '558fcdafbb63a87c019218d6e49daf8a',
191b7cbb 16 'info_dict': {
6be17c08
S
17 'id': '318131',
18 'display_id': 'amateur-teen-playing-and-masturbating-318131',
191b7cbb 19 'ext': 'mp4',
6be17c08 20 'title': 'amateur teen playing and masturbating',
ec85ded8 21 'thumbnail': r're:^https?://.*\.jpg$',
6be17c08
S
22 'upload_date': '20121114',
23 'view_count': int,
24 'like_count': int,
25 'dislike_count': int,
191b7cbb 26 'age_limit': 18,
77ae6587 27 }
6be17c08
S
28 }, {
29 # This video is no longer available
30 'url': 'http://www.mofosex.com/videos/5018/japanese-teen-music-video.html',
31 'only_matching': True,
32 }]
77ae6587 33
34 def _real_extract(self, url):
6be17c08
S
35 webpage, info = self._extract_info(url)
36
37 view_count = str_to_int(self._search_regex(
38 r'VIEWS:</span>\s*([\d,.]+)', webpage, 'view count', fatal=False))
39 like_count = int_or_none(self._search_regex(
40 r'id=["\']amountLikes["\'][^>]*>(\d+)', webpage,
41 'like count', fatal=False))
42 dislike_count = int_or_none(self._search_regex(
43 r'id=["\']amountDislikes["\'][^>]*>(\d+)', webpage,
44 'like count', fatal=False))
45 upload_date = unified_strdate(self._html_search_regex(
46 r'Added:</span>([^<]+)', webpage, 'upload date', fatal=False))
47
48 info.update({
49 'view_count': view_count,
50 'like_count': like_count,
51 'dislike_count': dislike_count,
52 'upload_date': upload_date,
53 'thumbnail': self._og_search_thumbnail(webpage),
54 })
55
56 return info