From 0b51005b4819e7cea222fcbaf8e60391db4f732c Mon Sep 17 00:00:00 2001 From: garret1317 Date: Thu, 28 Aug 2025 02:19:25 +0100 Subject: [PATCH] [ie/ITVBTCC] Fix extractor (#14161) Closes #14156 Authored by: garret1317 --- yt_dlp/extractor/itv.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/yt_dlp/extractor/itv.py b/yt_dlp/extractor/itv.py index 89e6f189cb..1f4020847c 100644 --- a/yt_dlp/extractor/itv.py +++ b/yt_dlp/extractor/itv.py @@ -18,6 +18,7 @@ from ..utils import ( url_or_none, urljoin, ) +from ..utils.traversal import traverse_obj class ITVIE(InfoExtractor): @@ -223,6 +224,7 @@ class ITVBTCCIE(InfoExtractor): }, 'playlist_count': 12, }, { + # news page, can have absent `data` field 'url': 'https://www.itv.com/news/2021-10-27/i-have-to-protect-the-country-says-rishi-sunak-as-uk-faces-interest-rate-hike', 'info_dict': { 'id': 'i-have-to-protect-the-country-says-rishi-sunak-as-uk-faces-interest-rate-hike', @@ -243,7 +245,7 @@ class ITVBTCCIE(InfoExtractor): entries = [] for video in json_map: - if not any(video['data'].get(attr) == 'Brightcove' for attr in ('name', 'type')): + if not any(traverse_obj(video, ('data', attr)) == 'Brightcove' for attr in ('name', 'type')): continue video_id = video['data']['id'] account_id = video['data']['accountId']