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.

54 lines
1.7 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. class EmpflixIE(InfoExtractor):
  5. _VALID_URL = r'^https?://www\.empflix\.com/videos/.*?-(?P<id>[0-9]+)\.html'
  6. _TEST = {
  7. 'url': 'http://www.empflix.com/videos/Amateur-Finger-Fuck-33051.html',
  8. 'md5': 'b1bc15b6412d33902d6e5952035fcabc',
  9. 'info_dict': {
  10. 'id': '33051',
  11. 'ext': 'mp4',
  12. 'title': 'Amateur Finger Fuck',
  13. 'description': 'Amateur solo finger fucking.',
  14. 'age_limit': 18,
  15. }
  16. }
  17. def _real_extract(self, url):
  18. mobj = re.match(self._VALID_URL, url)
  19. video_id = mobj.group('id')
  20. webpage = self._download_webpage(url, video_id)
  21. age_limit = self._rta_search(webpage)
  22. video_title = self._html_search_regex(
  23. r'name="title" value="(?P<title>[^"]*)"', webpage, 'title')
  24. video_description = self._html_search_regex(
  25. r'name="description" value="([^"]*)"', webpage, 'description', fatal=False)
  26. cfg_url = self._html_search_regex(
  27. r'flashvars\.config = escape\("([^"]+)"',
  28. webpage, 'flashvars.config')
  29. cfg_xml = self._download_xml(
  30. cfg_url, video_id, note='Downloading metadata')
  31. formats = [
  32. {
  33. 'url': item.find('videoLink').text,
  34. 'format_id': item.find('res').text,
  35. } for item in cfg_xml.findall('./quality/item')
  36. ]
  37. return {
  38. 'id': video_id,
  39. 'title': video_title,
  40. 'description': video_description,
  41. 'formats': formats,
  42. 'age_limit': age_limit,
  43. }