]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/mofosex.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
  11 from .keezmovies 
import KeezMoviesIE
 
  14 class MofosexIE(KeezMoviesIE
): 
  15     _VALID_URL 
= r
'https?://(?:www\.)?mofosex\.com/videos/(?P<id>\d+)/(?P<display_id>[^/?#&.]+)\.html' 
  17         'url': 'http://www.mofosex.com/videos/318131/amateur-teen-playing-and-masturbating-318131.html', 
  18         'md5': '558fcdafbb63a87c019218d6e49daf8a', 
  21             'display_id': 'amateur-teen-playing-and-masturbating-318131', 
  23             'title': 'amateur teen playing and masturbating', 
  24             'thumbnail': r
're:^https?://.*\.jpg$', 
  25             'upload_date': '20121114', 
  32         # This video is no longer available 
  33         'url': 'http://www.mofosex.com/videos/5018/japanese-teen-music-video.html', 
  34         'only_matching': True, 
  37     def _real_extract(self
, url
): 
  38         webpage
, info 
= self
._extract
_info
(url
) 
  40         view_count 
= str_to_int(self
._search
_regex
( 
  41             r
'VIEWS:</span>\s*([\d,.]+)', webpage
, 'view count', fatal
=False)) 
  42         like_count 
= int_or_none(self
._search
_regex
( 
  43             r
'id=["\']amountLikes
["\'][^>]*>(\d+)', webpage, 
  44             'like count', fatal=False)) 
  45         dislike_count = int_or_none(self._search_regex( 
  46             r'id=["\']amountDislikes
["\'][^>]*>(\d+)', webpage, 
  47             'like count', fatal=False)) 
  48         upload_date = unified_strdate(self._html_search_regex( 
  49             r'Added:</span>([^<]+)', webpage, 'upload date', fatal=False)) 
  52             'view_count': view_count, 
  53             'like_count': like_count, 
  54             'dislike_count': dislike_count, 
  55             'upload_date': upload_date, 
  56             'thumbnail': self._og_search_thumbnail(webpage), 
  62 class MofosexEmbedIE(InfoExtractor): 
  63     _VALID_URL = r'https?://(?:www\.)?mofosex\.com/embed/?\?.*?\bvideoid=(?P<id>\d+)' 
  65         'url': 'https://www.mofosex.com/embed/?videoid=318131&referrer=KM', 
  66         'only_matching': True, 
  70     def _extract_urls(webpage): 
  72             r'<iframe[^>]+\bsrc=["\']((?
:https?
:)?
//(?
:www\
.)?mofosex\
.com
/embed
/?
\?.*?
\bvideoid
=\d
+)', 
  75     def _real_extract(self, url): 
  76         video_id = self._match_id(url) 
  77         return self.url_result( 
  78             'http
://www
.mofosex
.com
/videos
/{0}
/{0}
.html
'.format(video_id), 
  79             ie=MofosexIE.ie_key(), video_id=video_id)