auengine.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. video_url = re.findall(r'http://\w+.auengine.com/vod/.*[^\W]', webpage)
  26. video_url = map(compat_urllib_parse.unquote, video_url)[0]
  27. thumbnail = re.findall(r'http://\w+.auengine.com/thumb/.*[^\W]', webpage)
  28. thumbnail = map(compat_urllib_parse.unquote, thumbnail)[0]
  29. if video_url == "" and thumbnail =="":
  30. raise ExtractorError('Could not find video URL')
  31. ext = '.' + determine_ext(video_url)
  32. if ext == title[-len(ext):]:
  33. title = title[:-len(ext)]
  34. return {
  35. 'id': video_id,
  36. 'url': video_url,
  37. 'title': title,
  38. 'thumbnail': thumbnail,
  39. 'http_referer': 'http://www.auengine.com/flowplayer/flowplayer.commercial-3.2.14.swf',
  40. }