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.

38 lines
1.3 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. _VALID_URL = r'(?:http://)?(?:www\.)?auengine\.com/embed.php\?.*?file=([^&]+).*?'
  10. def _real_extract(self, url):
  11. mobj = re.match(self._VALID_URL, url)
  12. video_id = mobj.group(1)
  13. webpage = self._download_webpage(url, video_id)
  14. title = self._html_search_regex(r'<title>(?P<title>.+?)</title>',
  15. webpage, u'title')
  16. title = title.strip()
  17. links = re.findall(r'[^A-Za-z0-9]?(?:file|url):\s*["\'](http[^\'"&]*)', webpage)
  18. links = [compat_urllib_parse.unquote(l) for l in links]
  19. for link in links:
  20. root, pathext = os.path.splitext(compat_urllib_parse_urlparse(link).path)
  21. if pathext == '.png':
  22. thumbnail = link
  23. elif pathext == '.mp4':
  24. url = link
  25. ext = pathext
  26. if ext == title[-len(ext):]:
  27. title = title[:-len(ext)]
  28. ext = ext[1:]
  29. return [{
  30. 'id': video_id,
  31. 'url': url,
  32. 'ext': ext,
  33. 'title': title,
  34. 'thumbnail': thumbnail,
  35. }]