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.

40 lines
1.2 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..compat import compat_urllib_parse_unquote_plus
  5. from ..utils import (
  6. js_to_json,
  7. )
  8. class KaraoketvIE(InfoExtractor):
  9. _VALID_URL = r'http://karaoketv\.co\.il/\?container=songs&id=(?P<id>[0-9]+)'
  10. _TEST = {
  11. 'url': 'http://karaoketv.co.il/?container=songs&id=171568',
  12. 'info_dict': {
  13. 'id': '171568',
  14. 'ext': 'mp4',
  15. 'title': 'אל העולם שלך - רותם כהן - שרים קריוקי',
  16. }
  17. }
  18. def _real_extract(self, url):
  19. video_id = self._match_id(url)
  20. webpage = self._download_webpage(url, video_id)
  21. page_video_url = self._og_search_video_url(webpage, video_id)
  22. config_json = compat_urllib_parse_unquote_plus(self._search_regex(
  23. r'config=(.*)', page_video_url, 'configuration'))
  24. urls_info_json = self._download_json(
  25. config_json, video_id, 'Downloading configuration',
  26. transform_source=js_to_json)
  27. url = urls_info_json['playlist'][0]['url']
  28. return {
  29. 'id': video_id,
  30. 'title': self._og_search_title(webpage),
  31. 'url': url,
  32. }