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.2 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class VidziIE(InfoExtractor):
  5. _VALID_URL = r'https?://(?:www\.)?vidzi\.tv/(?P<id>\w+)'
  6. _TEST = {
  7. 'url': 'http://vidzi.tv/cghql9yq6emu.html',
  8. 'md5': '4f16c71ca0c8c8635ab6932b5f3f1660',
  9. 'info_dict': {
  10. 'id': 'cghql9yq6emu',
  11. 'ext': 'mp4',
  12. 'title': 'youtube-dl test video 1\\\\2\'3/4<5\\\\6ä7↭',
  13. },
  14. }
  15. def _real_extract(self, url):
  16. video_id = self._match_id(url)
  17. webpage = self._download_webpage(url, video_id)
  18. video_host = self._html_search_regex(
  19. r'id=\'vplayer\'><img src="http://(.*?)/i', webpage,
  20. 'video host')
  21. video_hash = self._html_search_regex(
  22. r'\|([a-z0-9]+)\|hls\|type', webpage, 'video_hash')
  23. ext = self._html_search_regex(
  24. r'\|tracks\|([a-z0-9]+)\|', webpage, 'video ext')
  25. video_url = 'http://' + video_host + '/' + video_hash + '/v.' + ext
  26. title = self._html_search_regex(
  27. r'(?s)<h2 class="video-title">(.*?)</h2>', webpage, 'title')
  28. return {
  29. 'id': video_id,
  30. 'title': title,
  31. 'url': video_url,
  32. }