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.3 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. ExtractorError,
  6. )
  7. class EmpflixIE(InfoExtractor):
  8. _VALID_URL = r'^https?://www\.empflix\.com/videos/.*?-(?P<id>[0-9]+)\.html'
  9. _TEST = {
  10. 'url': 'http://www.empflix.com/videos/Amateur-Finger-Fuck-33051.html',
  11. 'md5': '5e5cc160f38ca9857f318eb97146e13e',
  12. 'info_dict': {
  13. 'id': '33051',
  14. 'ext': 'flv',
  15. 'title': 'Amateur Finger Fuck',
  16. 'age_limit': 18,
  17. }
  18. }
  19. def _real_extract(self, url):
  20. mobj = re.match(self._VALID_URL, url)
  21. video_id = mobj.group('id')
  22. webpage = self._download_webpage(url, video_id)
  23. age_limit = self._rta_search(webpage)
  24. video_title = self._html_search_regex(
  25. r'name="title" value="(?P<title>[^"]*)"', webpage, 'title')
  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. video_url = cfg_xml.find('videoLink').text
  32. return {
  33. 'id': video_id,
  34. 'url': video_url,
  35. 'ext': 'flv',
  36. 'title': video_title,
  37. 'age_limit': age_limit,
  38. }