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

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 .jwplatform import JWPlatformBaseIE
  4. from ..utils import (
  5. decode_packed_codes,
  6. js_to_json,
  7. )
  8. class VidziIE(JWPlatformBaseIE):
  9. _VALID_URL = r'https?://(?:www\.)?vidzi\.tv/(?:embed-)?(?P<id>[0-9a-zA-Z]+)'
  10. _TESTS = [{
  11. 'url': 'http://vidzi.tv/cghql9yq6emu.html',
  12. 'md5': '4f16c71ca0c8c8635ab6932b5f3f1660',
  13. 'info_dict': {
  14. 'id': 'cghql9yq6emu',
  15. 'ext': 'mp4',
  16. 'title': 'youtube-dl test video 1\\\\2\'3/4<5\\\\6ä7↭',
  17. },
  18. 'params': {
  19. # m3u8 download
  20. 'skip_download': True,
  21. },
  22. }, {
  23. 'url': 'http://vidzi.tv/embed-4z2yb0rzphe9-600x338.html',
  24. 'skip_download': True,
  25. }]
  26. def _real_extract(self, url):
  27. video_id = self._match_id(url)
  28. webpage = self._download_webpage(
  29. 'http://vidzi.tv/%s' % video_id, video_id)
  30. title = self._html_search_regex(
  31. r'(?s)<h2 class="video-title">(.*?)</h2>', webpage, 'title')
  32. code = decode_packed_codes(webpage).replace('\\\'', '\'')
  33. jwplayer_data = self._parse_json(
  34. self._search_regex(r'setup\(([^)]+)\)', code, 'jwplayer data'),
  35. video_id, transform_source=js_to_json)
  36. info_dict = self._parse_jwplayer_data(jwplayer_data, video_id, require_title=False)
  37. info_dict['title'] = title
  38. return info_dict