diff options
Diffstat (limited to 'yt_dlp/extractor/nbc.py')
-rw-r--r-- | yt_dlp/extractor/nbc.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/yt_dlp/extractor/nbc.py b/yt_dlp/extractor/nbc.py index 666550a49..2d3aa26ec 100644 --- a/yt_dlp/extractor/nbc.py +++ b/yt_dlp/extractor/nbc.py @@ -1,6 +1,7 @@ import base64 import json import re +import xml.etree.ElementTree from .common import InfoExtractor from .theplatform import ThePlatformIE, default_ns @@ -803,8 +804,10 @@ class NBCStationsIE(InfoExtractor): smil = self._download_xml( f'https://link.theplatform.com/s/{pdk_acct}/{player_id}', video_id, note='Downloading SMIL data', query=query, fatal=is_live) - subtitles = self._parse_smil_subtitles(smil, default_ns) if smil else {} - for video in smil.findall(self._xpath_ns('.//video', default_ns)) if smil else []: + if not isinstance(smil, xml.etree.ElementTree.Element): + smil = None + subtitles = self._parse_smil_subtitles(smil, default_ns) if smil is not None else {} + for video in smil.findall(self._xpath_ns('.//video', default_ns)) if smil is not None else []: info['duration'] = float_or_none(remove_end(video.get('dur'), 'ms'), 1000) video_src_url = video.get('src') ext = mimetype2ext(video.get('type'), default=determine_ext(video_src_url)) |