From ddc7e9a1bbf91741283d9b380eec45b6a58d17b2 Mon Sep 17 00:00:00 2001 From: marieell Date: Wed, 28 Aug 2024 22:58:11 +0200 Subject: [PATCH] [ie/ARD] Use traverse_obj Co-authored-by: Simon Sawicki --- yt_dlp/extractor/ard.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/yt_dlp/extractor/ard.py b/yt_dlp/extractor/ard.py index 54666ecfaf..795b10df92 100644 --- a/yt_dlp/extractor/ard.py +++ b/yt_dlp/extractor/ard.py @@ -678,11 +678,13 @@ class ARDAudiothekIE(InfoExtractor): 'description': ('description', {str}), })) - item = self.graphql_query(display_id, self._QUERY_ITEM % video_id)['item'] - audio_list = item.get('audioList', []) return { 'display_id': display_id, - 'formats': [{'url': x['href'], 'format_id': x['distributionType']} for x in audio_list], + 'formats': traverse_obj(self.graphql_query(display_id, self._QUERY_ITEM % video_id), ( + 'item', 'audioList', lambda _, v: url_or_none(v['href']), { + 'url': 'href', + 'format_id': ('distributionType', {str}), + })), 'id': video_id, **traverse_obj(item, { 'description': ('synopsis', {str}),