]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/ertgr.py
[ie/generic] Add `key_query` extractor-arg
[yt-dlp.git] / yt_dlp / extractor / ertgr.py
index 19c6933e7fdc5aaacd2f77aab373baa58b80e996..864aa6dc5a6e7fbb31db5e4c5f518ec185a5f2c1 100644 (file)
@@ -2,7 +2,6 @@
 import re
 
 from .common import InfoExtractor
-from ..compat import compat_str
 from ..utils import (
     ExtractorError,
     clean_html,
@@ -30,19 +29,19 @@ def _call_api(
         headers = headers or {}
         if data:
             headers['Content-Type'] = headers_as_param['Content-Type'] = 'application/json;charset=utf-8'
-            data = json.dumps(merge_dicts(platform_codename, data)).encode('utf-8')
+            data = json.dumps(merge_dicts(platform_codename, data)).encode()
         query = merge_dicts(
             {} if data else platform_codename,
             {'$headers': json.dumps(headers_as_param)},
             params)
         response = self._download_json(
-            'https://api.app.ertflix.gr/v%s/%s' % (str(api_version), method),
+            f'https://api.app.ertflix.gr/v{api_version!s}/{method}',
             video_id, fatal=False, query=query, data=data, headers=headers)
         if try_get(response, lambda x: x['Result']['Success']) is True:
             return response
 
     def _call_api_get_tiles(self, video_id, *tile_ids):
-        requested_tile_ids = [video_id] + list(tile_ids)
+        requested_tile_ids = [video_id, *tile_ids]
         requested_tiles = [{'Id': tile_id} for tile_id in requested_tile_ids]
         tiles_response = self._call_api(
             video_id, method='Tile/GetTiles', api_version=2,
@@ -174,9 +173,9 @@ class ERTFlixIE(ERTFlixBaseIE):
     }]
 
     def _extract_episode(self, episode):
-        codename = try_get(episode, lambda x: x['Codename'], compat_str)
+        codename = try_get(episode, lambda x: x['Codename'], str)
         title = episode.get('Title')
-        description = clean_html(dict_get(episode, ('ShortDescription', 'TinyDescription')))
+        description = clean_html(dict_get(episode, ('ShortDescription', 'TinyDescription')))
         if not codename or not title or not episode.get('HasPlayableStream', True):
             return
         thumbnail = next((
@@ -195,7 +194,7 @@ def _extract_episode(self, episode):
             'timestamp': parse_iso8601(episode.get('PublishDate')),
             'duration': episode.get('DurationSeconds'),
             'age_limit': self._parse_age_rating(episode),
-            'url': 'ertflix:%s' % (codename, ),
+            'url': f'ertflix:{codename}',
         }
 
     @staticmethod
@@ -212,7 +211,7 @@ def _extract_series(self, video_id, season_titles=None, season_numbers=None):
         series_info = {
             'age_limit': self._parse_age_rating(series),
             'title': series.get('Title'),
-            'description': dict_get(series, ('ShortDescription', 'TinyDescription')),
+            'description': dict_get(series, ('ShortDescription', 'TinyDescription')),
         }
         if season_numbers:
             season_titles = season_titles or []
@@ -281,7 +280,7 @@ class ERTWebtvEmbedIE(InfoExtractor):
             'id': 'trailers/E2251_TO_DIKTYO_E09_16-01_1900.mp4',
             'title': 'md5:914f06a73cd8b62fbcd6fb90c636e497',
             'ext': 'mp4',
-            'thumbnail': 'https://program.ert.gr/photos/2022/1/to_diktio_ep09_i_istoria_tou_diadiktiou_stin_Ellada_1021x576.jpg'
+            'thumbnail': 'https://program.ert.gr/photos/2022/1/to_diktio_ep09_i_istoria_tou_diadiktiou_stin_Ellada_1021x576.jpg',
         },
     }]