megavideozeu.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # encoding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. int_or_none,
  6. parse_filesize,
  7. unified_strdate,
  8. )
  9. class MegavideozeuIE(InfoExtractor):
  10. _VALID_URL = r'https?://(?:www\.)?megavideoz\.eu/video/(?P<id>.*)(?:.*)'
  11. def _real_extract(self, url):
  12. tmp_video_id = self._match_id(url)
  13. webpage = self._download_webpage(url, tmp_video_id)
  14. config_php = self._html_search_regex(
  15. r'var cnf = \'([^\']+)\'', webpage, 'config.php url')
  16. configpage = self._download_webpage(config_php, tmp_video_id)
  17. video_id = self._html_search_regex(
  18. r'<mediaid>([^<]+)', configpage, 'video id')
  19. video_url = self._html_search_regex(
  20. r'<file>([^<]+)', configpage, 'video URL')
  21. title = self._html_search_regex(
  22. r'<title><!\[CDATA\[([^\]]+)', configpage, 'title')
  23. duration = int_or_none(self._html_search_regex(
  24. r'<duration>([0-9]+)', configpage, 'duration', fatal=False))
  25. return {
  26. 'id': video_id,
  27. 'url': video_url,
  28. 'title': title,
  29. 'duration': duration
  30. }