]> jfr.im git - yt-dlp.git/blame - youtube_dlc/extractor/tvnoe.py
[skip travis] renaming
[yt-dlp.git] / youtube_dlc / extractor / tvnoe.py
CommitLineData
78e762d2
MC
1# coding: utf-8
2from __future__ import unicode_literals
3
a4a554a7 4from .common import InfoExtractor
9127e153
YCH
5from ..utils import (
6 clean_html,
7 get_element_by_class,
8 js_to_json,
9)
78e762d2
MC
10
11
a4a554a7 12class TVNoeIE(InfoExtractor):
6cfcb8ac 13 _VALID_URL = r'https?://(?:www\.)?tvnoe\.cz/video/(?P<id>[0-9]+)'
78e762d2
MC
14 _TEST = {
15 'url': 'http://www.tvnoe.cz/video/10362',
16 'md5': 'aee983f279aab96ec45ab6e2abb3c2ca',
17 'info_dict': {
18 'id': '10362',
19 'ext': 'mp4',
20 'series': 'Noční univerzita',
9127e153 21 'title': 'prof. Tomáš Halík, Th.D. - Návrat náboženství a střet civilizací',
78e762d2
MC
22 'description': 'md5:f337bae384e1a531a52c55ebc50fff41',
23 }
24 }
25
26 def _real_extract(self, url):
27 video_id = self._match_id(url)
28 webpage = self._download_webpage(url, video_id)
29
9127e153
YCH
30 iframe_url = self._search_regex(
31 r'<iframe[^>]+src="([^"]+)"', webpage, 'iframe URL')
78e762d2
MC
32
33 ifs_page = self._download_webpage(iframe_url, video_id)
c73e330e
RU
34 jwplayer_data = self._find_jwplayer_data(
35 ifs_page, video_id, transform_source=js_to_json)
78e762d2
MC
36 info_dict = self._parse_jwplayer_data(
37 jwplayer_data, video_id, require_title=False, base_url=iframe_url)
38
39 info_dict.update({
40 'id': video_id,
9127e153
YCH
41 'title': clean_html(get_element_by_class(
42 'field-name-field-podnazev', webpage)),
43 'description': clean_html(get_element_by_class(
44 'field-name-body', webpage)),
78e762d2
MC
45 'series': clean_html(get_element_by_class('title', webpage))
46 })
9127e153 47
78e762d2 48 return info_dict