]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/karaoketv.py
Add support for https for all extractors as preventive and future-proof measure
[yt-dlp.git] / youtube_dl / extractor / karaoketv.py
CommitLineData
c816336c 1# coding: utf-8
2from __future__ import unicode_literals
3
c816336c 4from .common import InfoExtractor
899a3e2f 5from ..compat import compat_urllib_parse_unquote_plus
c80ede5f 6from ..utils import (
c80ede5f
PH
7 js_to_json,
8)
c816336c 9
10
11class KaraoketvIE(InfoExtractor):
5886b38d 12 _VALID_URL = r'https?://karaoketv\.co\.il/\?container=songs&id=(?P<id>[0-9]+)'
c816336c 13 _TEST = {
14 'url': 'http://karaoketv.co.il/?container=songs&id=171568',
15 'info_dict': {
16 'id': '171568',
17 'ext': 'mp4',
18 'title': 'אל העולם שלך - רותם כהן - שרים קריוקי',
19 }
20 }
21
22 def _real_extract(self, url):
c80ede5f 23 video_id = self._match_id(url)
c816336c 24 webpage = self._download_webpage(url, video_id)
25
c80ede5f 26 page_video_url = self._og_search_video_url(webpage, video_id)
899a3e2f 27 config_json = compat_urllib_parse_unquote_plus(self._search_regex(
c80ede5f 28 r'config=(.*)', page_video_url, 'configuration'))
c816336c 29
c80ede5f
PH
30 urls_info_json = self._download_json(
31 config_json, video_id, 'Downloading configuration',
32 transform_source=js_to_json)
c816336c 33
34 url = urls_info_json['playlist'][0]['url']
35
36 return {
37 'id': video_id,
38 'title': self._og_search_title(webpage),
39 'url': url,
c80ede5f 40 }