1 # -*- coding: utf-8 -*-
3 from __future__ import unicode_literals
5 from .common import InfoExtractor
10 class Puls4IE(InfoExtractor):
12 _VALID_URL = r'https?://www.puls4.com/video/.+?/play/(?P<id>[0-9]+)'
14 'url': 'http://www.puls4.com/video/pro-und-contra/play/2716816',
15 'md5': '49f6a6629747eeec43cef6a46b5df81d',
19 'title': 'Pro und Contra vom 23.02.2015'}},
21 'url': 'http://www.puls4.com/video/kult-spielfilme/play/1298106',
22 'md5': '6a48316c8903ece8dab9b9a7bf7a59ec',
26 'title': 'Lucky Fritz'}}
29 def _real_extract(self, url):
30 video_id = self._match_id(url)
31 webpage = self._download_webpage(url, video_id)
34 real_url = self._html_search_regex(r'\"fsk-button\".+?href=\"([^"]+)',
35 webpage, 'fsk_button', default=None)
37 webpage = self._download_webpage(real_url, video_id)
39 title = self._html_search_regex(
40 r'<div id="bg_brandableContent">.+?<h1>(.+?)</h1>',
41 webpage, 'title', flags=re.DOTALL)
43 sd_url = self._html_search_regex(
44 r'{\"url\":\"([^"]+?)\",\"hd\":false',
45 webpage, 'sd_url').replace('\\', '')
47 formats = [{'format_id': 'sd', 'url': sd_url, 'quality': -2}]
49 hd_url = self._html_search_regex(
50 r'{\"url\":\"([^"]+?)\",\"hd\":true',
51 webpage, 'hd_url', default=None)
53 hd_url = hd_url.replace('\\', '')
54 formats.append({'format_id': 'hd', 'url': hd_url, 'quality': -1})