From 651fe192d0d98828b83205373dc695a84521659e Mon Sep 17 00:00:00 2001 From: Jan 'Yenda' Trmal Date: Fri, 10 Jan 2020 10:39:57 +0100 Subject: [PATCH] coding conventions --- youtube_dl/extractor/tvnoe.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/youtube_dl/extractor/tvnoe.py b/youtube_dl/extractor/tvnoe.py index 5ad001905..6c6ec8d1f 100644 --- a/youtube_dl/extractor/tvnoe.py +++ b/youtube_dl/extractor/tvnoe.py @@ -23,18 +23,26 @@ class TVNoeIE(InfoExtractor): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - dash_url = self._search_regex( - r"\s*src:\s*\'(?Phttps?://[^\']+manifest.mpd)\',", webpage, 'mpd') - hls_url = self._search_regex( - r"\s*src:\s*\'(?Phttps?://[^\']+playlist.m3u8)\',", webpage, 'm3u8') - formats = [] + hls_url = self._search_regex( + r"\s*src:\s*\'(?Phttps?://[^\']+playlist.m3u8)\',", webpage, 'm3u8', fatal=False) + if hls_url: + dash_url = self._search_regex( + r"\s*src:\s*\'(?Phttps?://[^\']+manifest.mpd)\',", webpage, 'mpd', fatal=False) + else: + dash_url = self._search_regex( + r"\s*src:\s*\'(?Phttps?://[^\']+manifest.mpd)\',", webpage, 'mpd') + if dash_url: formats.extend(self._extract_mpd_formats( dash_url, video_id, mpd_id='dash', fatal=False)) if hls_url: - formats.extend(self._extract_m3u8_formats( - hls_url, video_id, ext='mp4', m3u8_id='hls', fatal=False)) + if formats: + formats.extend(self._extract_m3u8_formats( + hls_url, video_id, ext='mp4', m3u8_id='hls', fatal=False)) + else: + formats.extend(self._extract_m3u8_formats( + hls_url, video_id, ext='mp4', m3u8_id='hls')) self._sort_formats(formats) title = clean_html(self._search_regex(