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.

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