aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/tvopengr.py
diff options
context:
space:
mode:
Diffstat (limited to 'yt_dlp/extractor/tvopengr.py')
-rw-r--r--yt_dlp/extractor/tvopengr.py19
1 files changed, 2 insertions, 17 deletions
diff --git a/yt_dlp/extractor/tvopengr.py b/yt_dlp/extractor/tvopengr.py
index 667f6660f..a11cdc6b0 100644
--- a/yt_dlp/extractor/tvopengr.py
+++ b/yt_dlp/extractor/tvopengr.py
@@ -7,7 +7,7 @@ from .common import InfoExtractor
from ..utils import (
determine_ext,
get_elements_text_and_html_by_attribute,
- merge_dicts,
+ scale_thumbnails_to_max_format_width,
unescapeHTML,
)
@@ -78,21 +78,6 @@ class TVOpenGrWatchIE(TVOpenGrBaseIE):
self._sort_formats(formats)
return formats, subs
- @staticmethod
- def _scale_thumbnails_to_max_width(formats, thumbnails, url_width_re):
- _keys = ('width', 'height')
- max_dimensions = max(
- [tuple(format.get(k) or 0 for k in _keys) for format in formats],
- default=(0, 0))
- if not max_dimensions[0]:
- return thumbnails
- return [
- merge_dicts(
- {'url': re.sub(url_width_re, str(max_dimensions[0]), thumbnail['url'])},
- dict(zip(_keys, max_dimensions)), thumbnail)
- for thumbnail in thumbnails
- ]
-
def _real_extract(self, url):
netloc, video_id, display_id = self._match_valid_url(url).group('netloc', 'id', 'slug')
if netloc.find('tvopen.gr') == -1:
@@ -102,7 +87,7 @@ class TVOpenGrWatchIE(TVOpenGrBaseIE):
info['formats'], info['subtitles'] = self._extract_formats_and_subs(
self._download_json(self._API_ENDPOINT, video_id, query={'cid': video_id}),
video_id)
- info['thumbnails'] = self._scale_thumbnails_to_max_width(
+ info['thumbnails'] = scale_thumbnails_to_max_format_width(
info['formats'], info['thumbnails'], r'(?<=/imgHandler/)\d+')
description, _html = next(get_elements_text_and_html_by_attribute('class', 'description', webpage))
if description and _html.startswith('<span '):