mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-08-30 07:41:42 +03:00
[ie/ntvcojp] style: Adjust code formatting for NTVJpCuIE
Adjusted line breaks and overall formatting of the NTVJpCuIE based on feedback from doe1080 and existing project coding style. Ensures consistency and readability.
This commit is contained in:
+12
-40
@@ -13,8 +13,7 @@ class NTVJpCuIE(StreaksBaseIE):
|
|||||||
IE_DESC = '日テレ無料TADA!'
|
IE_DESC = '日テレ無料TADA!'
|
||||||
|
|
||||||
_VALID_URL = r'https?://cu\.ntv\.co\.jp/(?!program-list)(?P<id>[\w-]+)/?$'
|
_VALID_URL = r'https?://cu\.ntv\.co\.jp/(?!program-list)(?P<id>[\w-]+)/?$'
|
||||||
_TESTS = [
|
_TESTS = [{
|
||||||
{
|
|
||||||
'url': 'https://cu.ntv.co.jp/gaki_20250525/',
|
'url': 'https://cu.ntv.co.jp/gaki_20250525/',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'gaki_20250525',
|
'id': 'gaki_20250525',
|
||||||
@@ -41,37 +40,23 @@ class NTVJpCuIE(StreaksBaseIE):
|
|||||||
'uploader': '日本テレビ放送網',
|
'uploader': '日本テレビ放送網',
|
||||||
'uploader_id': '0x7FE2',
|
'uploader_id': '0x7FE2',
|
||||||
},
|
},
|
||||||
},
|
}]
|
||||||
]
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
display_id = self._match_id(url)
|
display_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, display_id)
|
webpage = self._download_webpage(url, display_id)
|
||||||
|
|
||||||
info = traverse_obj(
|
info = traverse_obj(
|
||||||
self._search_json(
|
self._search_json(r'window\.app\s*=', webpage, 'video info', display_id),
|
||||||
r'window\.app\s*=',
|
('falcorCache', 'catalog', 'episode', display_id, 'value', {dict}), default={})
|
||||||
webpage,
|
|
||||||
'video info',
|
|
||||||
display_id,
|
|
||||||
),
|
|
||||||
('falcorCache', 'catalog', 'episode', display_id, 'value', {dict}),
|
|
||||||
default={},
|
|
||||||
)
|
|
||||||
media_id = traverse_obj(info, ('streaks_data', 'mediaid', {str_or_none}, {require('mediaID for Streaks')}))
|
media_id = traverse_obj(info, ('streaks_data', 'mediaid', {str_or_none}, {require('mediaID for Streaks')}))
|
||||||
non_phonetic = (lambda _, v: v['is_phonetic'] is False, 'value', {str})
|
non_phonetic = (lambda _, v: v['is_phonetic'] is False, 'value', {str})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
**self._extract_from_streaks_api(
|
**self._extract_from_streaks_api('ntv-tada', media_id, headers={
|
||||||
'ntv-tada',
|
|
||||||
media_id,
|
|
||||||
headers={
|
|
||||||
'X-Streaks-Api-Key': 'df497719056b44059a0483b8faad1f4a',
|
'X-Streaks-Api-Key': 'df497719056b44059a0483b8faad1f4a',
|
||||||
},
|
}),
|
||||||
),
|
**traverse_obj(info, {
|
||||||
**traverse_obj(
|
|
||||||
info,
|
|
||||||
{
|
|
||||||
'id': ('content_id', {str_or_none}),
|
'id': ('content_id', {str_or_none}),
|
||||||
'title': ('title', *non_phonetic, any),
|
'title': ('title', *non_phonetic, any),
|
||||||
'age_limit': ('is_adult_only_content', {lambda x: 18 if x else None}),
|
'age_limit': ('is_adult_only_content', {lambda x: 18 if x else None}),
|
||||||
@@ -80,31 +65,18 @@ class NTVJpCuIE(StreaksBaseIE):
|
|||||||
'release_timestamp': ('pub_date', {parse_iso8601}),
|
'release_timestamp': ('pub_date', {parse_iso8601}),
|
||||||
'tags': ('tags', ..., {str}),
|
'tags': ('tags', ..., {str}),
|
||||||
'thumbnail': ('artwork', ..., 'url', any, {url_or_none}),
|
'thumbnail': ('artwork', ..., 'url', any, {url_or_none}),
|
||||||
},
|
}),
|
||||||
),
|
**traverse_obj(info, ('tv_episode_info', {
|
||||||
**traverse_obj(
|
|
||||||
info,
|
|
||||||
(
|
|
||||||
'tv_episode_info',
|
|
||||||
{
|
|
||||||
'duration': ('duration', {int_or_none}),
|
'duration': ('duration', {int_or_none}),
|
||||||
'episode_number': ('episode_number', {int}),
|
'episode_number': ('episode_number', {int}),
|
||||||
'series': ('parent_show_title', *non_phonetic, any),
|
'series': ('parent_show_title', *non_phonetic, any),
|
||||||
'series_id': ('show_content_id', {str}),
|
'series_id': ('show_content_id', {str}),
|
||||||
},
|
})),
|
||||||
),
|
**traverse_obj(info, ('custom_data', {
|
||||||
),
|
|
||||||
**traverse_obj(
|
|
||||||
info,
|
|
||||||
(
|
|
||||||
'custom_data',
|
|
||||||
{
|
|
||||||
'description': ('program_detail', {str}),
|
'description': ('program_detail', {str}),
|
||||||
'episode': ('episode_title', {str}),
|
'episode': ('episode_title', {str}),
|
||||||
'episode_id': ('episode_id', {str_or_none}),
|
'episode_id': ('episode_id', {str_or_none}),
|
||||||
'uploader': ('network_name', {str}),
|
'uploader': ('network_name', {str}),
|
||||||
'uploader_id': ('network_id', {str}),
|
'uploader_id': ('network_id', {str}),
|
||||||
},
|
})),
|
||||||
),
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user