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.

58 lines
1.8 KiB

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