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.

50 lines
1.6 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. remove_end,
  9. )
  10. class AUEngineIE(InfoExtractor):
  11. _VALID_URL = r'http://(?:www\.)?auengine\.com/embed\.php\?.*?file=(?P<id>[^&]+).*?'
  12. _TEST = {
  13. 'url': 'http://auengine.com/embed.php?file=lfvlytY6&w=650&h=370',
  14. 'md5': '48972bdbcf1a3a2f5533e62425b41d4f',
  15. 'info_dict': {
  16. 'id': 'lfvlytY6',
  17. 'ext': 'mp4',
  18. 'title': '[Commie]The Legend of the Legendary Heroes - 03 - Replication Eye (Alpha Stigma)[F9410F5A]'
  19. }
  20. }
  21. def _real_extract(self, url):
  22. video_id = self._match_id(url)
  23. webpage = self._download_webpage(url, video_id)
  24. title = self._html_search_regex(
  25. r'<title>\s*(?P<title>.+?)\s*</title>', webpage, 'title')
  26. video_urls = re.findall(r'http://\w+.auengine.com/vod/.*[^\W]', webpage)
  27. video_url = compat_urllib_parse.unquote(video_urls[0])
  28. thumbnails = re.findall(r'http://\w+.auengine.com/thumb/.*[^\W]', webpage)
  29. thumbnail = compat_urllib_parse.unquote(thumbnails[0])
  30. if not video_url:
  31. raise ExtractorError('Could not find video URL')
  32. ext = '.' + determine_ext(video_url)
  33. title = remove_end(title, 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. }