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. from ..compat import compat_urllib_parse
  5. from ..utils import (
  6. determine_ext,
  7. ExtractorError,
  8. )
  9. class AUEngineIE(InfoExtractor):
  10. _VALID_URL = r'http://(?:www\.)?auengine\.com/embed\.php\?.*?file=(?P<id>[^&]+).*?'
  11. _TEST = {
  12. 'url': 'http://auengine.com/embed.php?file=lfvlytY6&w=650&h=370',
  13. 'md5': '48972bdbcf1a3a2f5533e62425b41d4f',
  14. 'info_dict': {
  15. 'id': 'lfvlytY6',
  16. 'ext': 'mp4',
  17. 'title': '[Commie]The Legend of the Legendary Heroes - 03 - Replication Eye (Alpha Stigma)[F9410F5A]'
  18. }
  19. }
  20. def _real_extract(self, url):
  21. video_id = self._match_id(url)
  22. webpage = self._download_webpage(url, video_id)
  23. title = self._html_search_regex(r'<title>(?P<title>.+?)</title>', webpage, 'title')
  24. title = title.strip()
  25. links = re.findall(r'\s(?:file|url):\s*["\']([^\'"]+)["\']', webpage)
  26. links = map(compat_urllib_parse.unquote, links)
  27. thumbnail = None
  28. video_url = None
  29. for link in links:
  30. if link.endswith('.png'):
  31. thumbnail = link
  32. elif '/videos/' in link:
  33. video_url = link
  34. if not video_url:
  35. raise ExtractorError('Could not find video URL')
  36. ext = '.' + determine_ext(video_url)
  37. if ext == title[-len(ext):]:
  38. title = title[:-len(ext)]
  39. return {
  40. 'id': video_id,
  41. 'url': video_url,
  42. 'title': title,
  43. 'thumbnail': thumbnail,
  44. 'http_referer': 'http://www.auengine.com/flowplayer/flowplayer.commercial-3.2.14.swf',
  45. }