safer _extract_chapters

Authored by: bashonly
This commit is contained in:
bashonly 2025-04-30 01:18:30 -05:00
parent 3cafe45074
commit daf2be0f25
No known key found for this signature in database
GPG Key ID: 783F096F253D15B0

View File

@ -56,10 +56,10 @@ class ZDFBaseIE(InfoExtractor):
return int(mobj.group('width')) / int(mobj.group('height')) if mobj else None
def _extract_chapters(self, data):
return traverse_obj(data, (lambda _, v: 'anchorOffset' in v, {
return traverse_obj(data, (lambda _, v: isinstance(v['anchorOffset'], (int, float)), {
'start_time': ('anchorOffset', {float_or_none}),
'title': ('anchorLabel', {str}),
}), default=None)
})) or None
@staticmethod
def _extract_subtitles(src):