2 from __future__ import unicode_literals
4 from .common import InfoExtractor
7 class KaraoketvIE(InfoExtractor):
8 _VALID_URL = r'http://www.karaoketv.co.il/[^/]+/(?P<id>\d+)'
10 'url': 'http://www.karaoketv.co.il/%D7%A9%D7%99%D7%A8%D7%99_%D7%A7%D7%A8%D7%99%D7%95%D7%A7%D7%99/58356/%D7%90%D7%99%D7%96%D7%95%D7%9F',
14 'title': 'קריוקי של איזון',
18 'skip_download': True,
22 def _real_extract(self, url):
23 video_id = self._match_id(url)
25 webpage = self._download_webpage(url, video_id)
26 api_page_url = self._search_regex(
27 r'<iframe[^>]+src=(["\'])(?P<url>https?://www\.karaoke\.co\.il/api_play\.php\?.+?)\1',
28 webpage, 'API play URL', group='url')
30 api_page = self._download_webpage(api_page_url, video_id)
31 video_cdn_url = self._search_regex(
32 r'<iframe[^>]+src=(["\'])(?P<url>https?://www\.video-cdn\.com/embed/iframe/.+?)\1',
33 api_page, 'video cdn URL', group='url')
35 video_cdn = self._download_webpage(video_cdn_url, video_id)
36 play_path = self._parse_json(
38 r'var\s+options\s*=\s*({.+?});', video_cdn, 'options'),
39 video_id)['clip']['url']
41 settings = self._parse_json(
43 r'var\s+settings\s*=\s*({.+?});', video_cdn, 'servers', default='{}'),
44 video_id, fatal=False) or {}
46 servers = settings.get('servers')
47 if not servers or not isinstance(servers, list):
48 servers = ('wowzail.video-cdn.com:80/vodcdn', )
51 'url': 'rtmp://%s' % server if not server.startswith('rtmp') else server,
52 'play_path': play_path,
54 'page_url': video_cdn_url,
55 'player_url': 'http://www.video-cdn.com/assets/flowplayer/flowplayer.commercial-3.2.18.swf',
56 'rtmp_real_time': True,
58 } for server in servers]
62 'title': self._og_search_title(webpage),