From c3c0b7a563cfcc8f4c6fb97d5fb495f24f2e0cee Mon Sep 17 00:00:00 2001 From: Lam Date: Mon, 20 Apr 2020 20:34:41 +0200 Subject: [PATCH] Revert "[tvn24] Fix metadata extraction (closes #21833, closes #21834)" This reverts commit 70066c1879ee238d4c3fed54318091e625cfb5ad. --- youtube_dl/extractor/tvn24.py | 42 ++++++++--------------------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/youtube_dl/extractor/tvn24.py b/youtube_dl/extractor/tvn24.py index 39f57ae6bb34..6590e1fd0180 100644 --- a/youtube_dl/extractor/tvn24.py +++ b/youtube_dl/extractor/tvn24.py @@ -4,7 +4,6 @@ from .common import InfoExtractor from ..utils import ( int_or_none, - NO_DEFAULT, unescapeHTML, ) @@ -21,18 +20,6 @@ class TVN24IE(InfoExtractor): 'description': 'Wyjątkowe orędzie Artura Andrusa, jednego z gości "Szkła kontaktowego".', 'thumbnail': 're:https?://.*[.]jpeg', } - }, { - # different layout - 'url': 'https://tvnmeteo.tvn24.pl/magazyny/maja-w-ogrodzie,13/odcinki-online,1,4,1,0/pnacza-ptaki-i-iglaki-odc-691-hgtv-odc-29,1771763.html', - 'info_dict': { - 'id': '1771763', - 'ext': 'mp4', - 'title': 'Pnącza, ptaki i iglaki (odc. 691 /HGTV odc. 29)', - 'thumbnail': 're:https?://.*', - }, - 'params': { - 'skip_download': True, - }, }, { 'url': 'http://fakty.tvn24.pl/ogladaj-online,60/53-konferencja-bezpieczenstwa-w-monachium,716431.html', 'only_matching': True, @@ -48,21 +35,18 @@ class TVN24IE(InfoExtractor): }] def _real_extract(self, url): - display_id = self._match_id(url) + video_id = self._match_id(url) - webpage = self._download_webpage(url, display_id) + webpage = self._download_webpage(url, video_id) - title = self._og_search_title( - webpage, default=None) or self._search_regex( - r']+class=["\']magazineItemHeader[^>]+>(.+?)(?!\1).+?)\1' % attr, webpage, - name, group='json', default=default, fatal=fatal) or '{}', - display_id, transform_source=unescapeHTML, fatal=fatal) + name, group='json', fatal=fatal) or '{}', + video_id, transform_source=unescapeHTML, fatal=fatal) quality_data = extract_json('data-quality', 'formats') @@ -75,24 +59,16 @@ def extract_json(attr, name, default=NO_DEFAULT, fatal=True): }) self._sort_formats(formats) - description = self._og_search_description(webpage, default=None) + description = self._og_search_description(webpage) thumbnail = self._og_search_thumbnail( webpage, default=None) or self._html_search_regex( r'\bdata-poster=(["\'])(?P(?!\1).+?)\1', webpage, 'thumbnail', group='url') - video_id = None - share_params = extract_json( - 'data-share-params', 'share params', default=None) + 'data-share-params', 'share params', fatal=False) if isinstance(share_params, dict): - video_id = share_params.get('id') - - if not video_id: - video_id = self._search_regex( - r'data-vid-id=["\'](\d+)', webpage, 'video id', - default=None) or self._search_regex( - r',(\d+)\.html', url, 'video id', default=display_id) + video_id = share_params.get('id') or video_id return { 'id': video_id,