1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-23 00:54:31 +01:00

fixing flake8 error

This commit is contained in:
Jan 'Yenda' Trmal 2020-01-26 21:06:34 +01:00
parent 651fe192d0
commit 6763b8e88d

View File

@ -4,15 +4,21 @@ from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
clean_html, clean_html,
url_or_none,
js_to_json,
try_get
)
from ..compat import (
compat_str
) )
class TVNoeIE(InfoExtractor): class TVNoeIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?tvnoe\.cz/porad/(?P<id>[-0-9a-z]+)' _VALID_URL = r'https?://(?:www\.)?tvnoe\.cz/porad/(?P<id>[0-9]+).*'
_TEST = { _TEST = {
'url': 'https://www.tvnoe.cz/porad/26011-terra-santa-news-13-11-2019', 'url': 'https://www.tvnoe.cz/porad/26011-terra-santa-news-13-11-2019',
'info_dict': { 'info_dict': {
'id': '26011-terra-santa-news-13-11-2019', 'id': '26011',
'ext': 'mp4', 'ext': 'mp4',
'series': 'Terra Santa News', 'series': 'Terra Santa News',
'title': '13. 11. 2019', 'title': '13. 11. 2019',
@ -24,14 +30,12 @@ class TVNoeIE(InfoExtractor):
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
formats = [] formats = []
hls_url = self._search_regex( json = self._search_regex(r'(?sm)var *INIT_PLAYER *= *(?P<json>[^;]+);', webpage, 'json')
r"\s*src:\s*\'(?P<url>https?://[^\']+playlist.m3u8)\',", webpage, 'm3u8', fatal=False) player_data = self._parse_json(json, video_id, js_to_json)
if hls_url: hls_url = url_or_none(try_get(player_data,
dash_url = self._search_regex( lambda x: x['tracks']['HLS'][0]['src'], compat_str))
r"\s*src:\s*\'(?P<url>https?://[^\']+manifest.mpd)\',", webpage, 'mpd', fatal=False) dash_url = url_or_none(try_get(player_data,
else: lambda x: x['tracks']['DASH'][0]['src'], compat_str))
dash_url = self._search_regex(
r"\s*src:\s*\'(?P<url>https?://[^\']+manifest.mpd)\',", webpage, 'mpd')
if dash_url: if dash_url:
formats.extend(self._extract_mpd_formats( formats.extend(self._extract_mpd_formats(
@ -45,10 +49,12 @@ class TVNoeIE(InfoExtractor):
hls_url, video_id, ext='mp4', m3u8_id='hls')) hls_url, video_id, ext='mp4', m3u8_id='hls'))
self._sort_formats(formats) self._sort_formats(formats)
title = clean_html(self._search_regex( title = clean_html(self._search_regex(
r"<h2>(?P<title>.*)<\/h2>", webpage, 'title')) r'<h2>(?P<title>.+)<\/h2>', webpage, 'title', fatal=False))
series = clean_html(self._search_regex( series = clean_html(self._search_regex(
r"<h1>(?P<series>.*)<\/h1>", webpage, 'series')) r'<h1>(?P<series>.+)<\/h1>', webpage, 'series', fatal=False))
return { return {
'id': video_id, 'id': video_id,
'title': title, 'title': title,