You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
2.0 KiB

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