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.

46 lines
1.4 KiB

10 years ago
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..compat import compat_urllib_parse_unquote
  5. class MalemotionIE(InfoExtractor):
  6. _VALID_URL = r'https?://malemotion\.com/video/(.+?)\.(?P<id>.+?)(#|$)'
  7. _TEST = {
  8. 'url': 'http://malemotion.com/video/bete-de-concours.ltc',
  9. 'md5': '3013e53a0afbde2878bc39998c33e8a5',
  10. 'info_dict': {
  11. 'id': 'ltc',
  12. 'ext': 'mp4',
  13. 'title': 'Bête de Concours',
  14. 'age_limit': 18,
  15. },
  16. }
  17. def _real_extract(self, url):
  18. video_id = self._match_id(url)
  19. webpage = self._download_webpage(url, video_id)
  20. video_url = compat_urllib_parse_unquote(self._search_regex(
  21. r'<source type="video/mp4" src="(.+?)"', webpage, 'video URL'))
  22. video_title = self._html_search_regex(
  23. r'<title>(.*?)</title', webpage, 'title')
  24. video_thumbnail = self._search_regex(
  25. r'<video .+?poster="(.+?)"', webpage, 'thumbnail', fatal=False)
  26. formats = [{
  27. 'url': video_url,
  28. 'ext': 'mp4',
  29. 'format_id': 'mp4',
  30. 'preference': 1,
  31. }]
  32. self._sort_formats(formats)
  33. return {
  34. 'id': video_id,
  35. 'formats': formats,
  36. 'title': video_title,
  37. 'thumbnail': video_thumbnail,
  38. 'age_limit': 18,
  39. }