different solution for traversal issues

This commit is contained in:
Kyle Gonsalves 2024-04-21 18:17:01 -07:00
parent 4b9a54b464
commit 6ef8990320

View file

@ -798,7 +798,7 @@ class BBCIE(BBCCoUkIE): # XXX: Do not subclass from concrete IE
'id': 'p0hj0lq7', 'id': 'p0hj0lq7',
'ext': 'mp4', 'ext': 'mp4',
'title': 'Nasser Hospital doctor describes his treatment by IDF', 'title': 'Nasser Hospital doctor describes his treatment by IDF',
'description': r're:(?s)Doctor Abu Sabha said he was detained by Israeli forces after .{276,} hostages\."$', 'description': r're:(?s)Doctor Abu Sabha said he was detained by Israeli forces after .{276} hostages\."$',
'thumbnail': r're:https?://.+/.+\.jpg', 'thumbnail': r're:https?://.+/.+\.jpg',
'timestamp': 1710188248, 'timestamp': 1710188248,
'upload_date': '20240311', 'upload_date': '20240311',
@ -1270,8 +1270,6 @@ def extract_all(pattern):
def parse_model(model): def parse_model(model):
'''Extract single video from model structure''' '''Extract single video from model structure'''
if isinstance(model, list):
model = model[0]
item_id = traverse_obj(model, ('versions', 0, 'versionId', {str})) item_id = traverse_obj(model, ('versions', 0, 'versionId', {str}))
if not item_id: if not item_id:
return return
@ -1298,7 +1296,7 @@ def parse_model(model):
..., 'contents', lambda _, v: v['type'] == 'video', ..., 'contents', lambda _, v: v['type'] == 'video',
'model', 'blocks', lambda _, v: v['type'] == 'media', 'model', 'blocks', lambda _, v: v['type'] == 'media',
'model', 'blocks', lambda _, v: v['type'] == 'mediaMetadata', 'model', 'blocks', lambda _, v: v['type'] == 'mediaMetadata',
'model')) 'model', {dict}, any))
if model: if model:
entry = parse_model(model) entry = parse_model(model)
if entry: if entry: