1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2025-02-18 10:07:55 +01:00

[tvnoe] Fixing/changing the extractor for TV Noe (Czech Christian TV)

This commit is contained in:
Jan 'Yenda' Trmal 2020-01-08 15:53:29 +01:00
parent 3cb05b86de
commit 9ea71d2e77

View File

@ -4,22 +4,18 @@ from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
clean_html, clean_html,
get_element_by_class,
js_to_json,
) )
class TVNoeIE(InfoExtractor): class TVNoeIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?tvnoe\.cz/video/(?P<id>[0-9]+)' _VALID_URL = r'https?://(?:www\.)?tvnoe\.cz/porad/(?P<id>[-0-9a-z]+)'
_TEST = { _TEST = {
'url': 'http://www.tvnoe.cz/video/10362', 'url': 'https://www.tvnoe.cz/porad/26011-terra-santa-news-13-11-2019',
'md5': 'aee983f279aab96ec45ab6e2abb3c2ca',
'info_dict': { 'info_dict': {
'id': '10362', 'id': '26011-terra-santa-news-13-11-2019',
'ext': 'mp4', 'ext': 'mp4',
'series': 'Noční univerzita', 'series': 'Terra Santa News',
'title': 'prof. Tomáš Halík, Th.D. - Návrat náboženství a střet civilizací', 'title': '13. 11. 2019',
'description': 'md5:f337bae384e1a531a52c55ebc50fff41',
} }
} }
@ -27,22 +23,27 @@ class TVNoeIE(InfoExtractor):
video_id = self._match_id(url) video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
iframe_url = self._search_regex( dash_url = self._search_regex(
r'<iframe[^>]+src="([^"]+)"', webpage, 'iframe URL') r"\s*src:\s*\'(?P<url>https?://[^\']+manifest.mpd)\',", webpage, 'mpd')
hls_url = self._search_regex(
r"\s*src:\s*\'(?P<url>https?://[^\']+playlist.m3u8)\',", webpage, 'm3u8')
ifs_page = self._download_webpage(iframe_url, video_id) formats = []
jwplayer_data = self._find_jwplayer_data( if dash_url:
ifs_page, video_id, transform_source=js_to_json) formats.extend(self._extract_mpd_formats(
info_dict = self._parse_jwplayer_data( dash_url, video_id, mpd_id='dash', fatal=False))
jwplayer_data, video_id, require_title=False, base_url=iframe_url) if hls_url:
formats.extend(self._extract_m3u8_formats(
hls_url, video_id, ext='mp4', m3u8_id='hls', fatal=False))
info_dict.update({ self._sort_formats(formats)
title = clean_html(self._search_regex(
r"<h2>(?P<title>.*)<\/h2>", webpage, 'title'))
series = clean_html(self._search_regex(
r"<h1>(?P<series>.*)<\/h1>", webpage, 'series'))
return {
'id': video_id, 'id': video_id,
'title': clean_html(get_element_by_class( 'title': title,
'field-name-field-podnazev', webpage)), 'series': series,
'description': clean_html(get_element_by_class( 'formats': formats
'field-name-body', webpage)), }
'series': clean_html(get_element_by_class('title', webpage))
})
return info_dict