diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2015-01-10 17:59:35 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2015-01-10 17:59:35 +0100 |
commit | bc694039e47cc871c98abacdf1c0a2e5a257a8a4 (patch) | |
tree | c5685af597d26065b10aa2776814cc0a8d97cd77 /youtube_dl | |
parent | 3462af03e6c8c64b916fe90ecea0ef7719438ad2 (diff) | |
parent | c816336cbdb91efa282c0ede8552157861f10e76 (diff) |
Merge remote-tracking branch 'lenaten/karaoketv'
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/__init__.py | 1 | ||||
-rw-r--r-- | youtube_dl/extractor/karaoketv.py | 47 |
2 files changed, 48 insertions, 0 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index fc83a7d07..647e0a8c2 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -207,6 +207,7 @@ from .jove import JoveIE from .jukebox import JukeboxIE from .jpopsukitv import JpopsukiIE from .kankan import KankanIE +from .karaoketv import KaraoketvIE from .keezmovies import KeezMoviesIE from .khanacademy import KhanAcademyIE from .kickstarter import KickStarterIE diff --git a/youtube_dl/extractor/karaoketv.py b/youtube_dl/extractor/karaoketv.py new file mode 100644 index 000000000..4d50308cc --- /dev/null +++ b/youtube_dl/extractor/karaoketv.py @@ -0,0 +1,47 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +import json +import sys + +from .common import InfoExtractor +from ..utils import compat_urllib_parse, ExtractorError + + +class KaraoketvIE(InfoExtractor): + _VALID_URL = r'http://karaoketv\.co\.il/\?container=songs&id=(?P<id>[0-9]+)' + _TEST = { + 'url': 'http://karaoketv.co.il/?container=songs&id=171568', + 'info_dict': { + 'id': '171568', + 'ext': 'mp4', + 'title': 'אל העולם שלך - רותם כהן - שרים קריוקי', + } + } + + def _real_extract(self, url): + + # BUG: SSL23_GET_SERVER_HELLO:unknown protocol + if sys.hexversion < 0x03000000: + raise ExtractorError("Only python 3 supported.\n") + + mobj = re.match(self._VALID_URL, url) + + video_id = mobj.group('id') + + webpage = self._download_webpage(url, video_id) + + settings_json = compat_urllib_parse.unquote_plus(self._search_regex(r'config=(.*)', self._og_search_video_url(webpage ,video_id), '')) + + urls_info_webpage = self._download_webpage(settings_json, 'Downloading settings json') + + urls_info_json = json.loads(urls_info_webpage.replace('\'', '"')) + + url = urls_info_json['playlist'][0]['url'] + + return { + 'id': video_id, + 'title': self._og_search_title(webpage), + 'url': url, + }
\ No newline at end of file |