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.

46 lines
1.6 KiB

  1. import os.path
  2. import re
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. compat_urllib_parse,
  6. compat_urllib_parse_urlparse,
  7. )
  8. class AUEngineIE(InfoExtractor):
  9. _TEST = {
  10. u'url': u'http://auengine.com/embed.php?file=lfvlytY6&w=650&h=370',
  11. u'file': u'lfvlytY6.mp4',
  12. u'md5': u'48972bdbcf1a3a2f5533e62425b41d4f',
  13. u'info_dict': {
  14. u"title": u"[Commie]The Legend of the Legendary Heroes - 03 - Replication Eye (Alpha Stigma)[F9410F5A]"
  15. }
  16. }
  17. _VALID_URL = r'(?:http://)?(?:www\.)?auengine\.com/embed.php\?.*?file=([^&]+).*?'
  18. def _real_extract(self, url):
  19. mobj = re.match(self._VALID_URL, url)
  20. video_id = mobj.group(1)
  21. webpage = self._download_webpage(url, video_id)
  22. title = self._html_search_regex(r'<title>(?P<title>.+?)</title>',
  23. webpage, u'title')
  24. title = title.strip()
  25. links = re.findall(r'[^A-Za-z0-9]?(?:file|url):\s*["\'](http[^\'"&]*)', webpage)
  26. links = [compat_urllib_parse.unquote(l) for l in links]
  27. for link in links:
  28. root, pathext = os.path.splitext(compat_urllib_parse_urlparse(link).path)
  29. if pathext == '.png':
  30. thumbnail = link
  31. elif pathext == '.mp4':
  32. url = link
  33. ext = pathext
  34. if ext == title[-len(ext):]:
  35. title = title[:-len(ext)]
  36. ext = ext[1:]
  37. return [{
  38. 'id': video_id,
  39. 'url': url,
  40. 'ext': ext,
  41. 'title': title,
  42. 'thumbnail': thumbnail,
  43. }]