mirror of
https://github.com/yt-dlp/yt-dlp
synced 2024-12-28 22:24:34 +01:00
return None when None/key not exist
This commit is contained in:
parent
b28dc2a424
commit
6f6cab852d
1 changed files with 4 additions and 3 deletions
|
@ -38,7 +38,8 @@ class KidoodleTVBaseIE(InfoExtractor):
|
||||||
def get_field(field_name, idx, webpage, data):
|
def get_field(field_name, idx, webpage, data):
|
||||||
value = self._html_search_regex(rf'{idx}\.{field_name}=(?P<a>"?(?P<b>.+?)"?);', webpage,
|
value = self._html_search_regex(rf'{idx}\.{field_name}=(?P<a>"?(?P<b>.+?)"?);', webpage,
|
||||||
field_name, default=None, group=('a', 'b'))
|
field_name, default=None, group=('a', 'b'))
|
||||||
return value[1] if value[1] != value[0] else (data.get(value[0]) or value[0])
|
return (value[1] if value[1] != value[0] else (
|
||||||
|
data.get(value[0]) if re.search(r'^[a-zA-Z_\$]{1,4}$', value[0]) else value[0]))
|
||||||
|
|
||||||
idx = idx.replace('$', r'\$')
|
idx = idx.replace('$', r'\$')
|
||||||
video_id = get_field('id', idx, webpage, data)
|
video_id = get_field('id', idx, webpage, data)
|
||||||
|
@ -139,7 +140,7 @@ class KidoodleTVIE(KidoodleTVBaseIE):
|
||||||
description = self._html_search_meta('description', webpage, 'description', default=None)
|
description = self._html_search_meta('description', webpage, 'description', default=None)
|
||||||
data_set = self._extract_data(webpage, video_id)
|
data_set = self._extract_data(webpage, video_id)
|
||||||
info = {}
|
info = {}
|
||||||
if idx := self._html_search_regex(rf'([\w\$]{{2,4}})\.seasonAndEpisode="{season_episode}";',
|
if idx := self._html_search_regex(rf'([\w\$]{{1,4}})\.seasonAndEpisode="{season_episode}";',
|
||||||
webpage, 'data_idx', default=None):
|
webpage, 'data_idx', default=None):
|
||||||
info = self._extract_by_idx(idx, webpage, data_set, video_id)
|
info = self._extract_by_idx(idx, webpage, data_set, video_id)
|
||||||
|
|
||||||
|
@ -180,7 +181,7 @@ class KidoodleTVSeriesIE(KidoodleTVBaseIE):
|
||||||
'description', default=None)
|
'description', default=None)
|
||||||
data_set = self._extract_data(webpage, series_id)
|
data_set = self._extract_data(webpage, series_id)
|
||||||
entries = []
|
entries = []
|
||||||
for idx_se in sorted(re.findall(r'([\w\$]{2,4})\.seasonAndEpisode="([^"]+)";', webpage),
|
for idx_se in sorted(re.findall(r'([\w\$]{1,4})\.seasonAndEpisode="([^"]+)";', webpage),
|
||||||
key=lambda x: x[1]):
|
key=lambda x: x[1]):
|
||||||
if entry := self._extract_by_idx(idx_se[0], webpage, data_set):
|
if entry := self._extract_by_idx(idx_se[0], webpage, data_set):
|
||||||
entry['series_id'] = series_id
|
entry['series_id'] = series_id
|
||||||
|
|
Loading…
Reference in a new issue