aboutsummaryrefslogtreecommitdiff
path: root/yt_dlp/extractor/slideslive.py
diff options
context:
space:
mode:
authorbashonly <88596187+bashonly@users.noreply.github.com>2023-11-14 14:28:18 -0600
committerGitHub <noreply@github.com>2023-11-14 20:28:18 +0000
commitd4f14a72dc1dd79396e0e80980268aee902b61e4 (patch)
tree4a55b93a8a2178c95ee9543f66bfb328577ef38a /yt_dlp/extractor/slideslive.py
parent87264d4fdadcddd91289b968dd0e4bf58d449267 (diff)
[ie] Do not test truth value of `xml.etree.ElementTree.Element` (#8582)
Testing the truthiness of an `xml.etree.ElementTree.Element` instance is deprecated in py3.12 Authored by: bashonly
Diffstat (limited to 'yt_dlp/extractor/slideslive.py')
-rw-r--r--yt_dlp/extractor/slideslive.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/yt_dlp/extractor/slideslive.py b/yt_dlp/extractor/slideslive.py
index 25f867a60..13f3109d7 100644
--- a/yt_dlp/extractor/slideslive.py
+++ b/yt_dlp/extractor/slideslive.py
@@ -1,5 +1,6 @@
import re
import urllib.parse
+import xml.etree.ElementTree
from .common import InfoExtractor
from ..utils import (
@@ -469,11 +470,12 @@ class SlidesLiveIE(InfoExtractor):
slides = self._download_xml(
player_info['slides_xml_url'], video_id, fatal=False,
note='Downloading slides XML', errnote='Failed to download slides info')
- slide_url_template = 'https://cdn.slideslive.com/data/presentations/%s/slides/big/%s%s'
- for slide_id, slide in enumerate(slides.findall('./slide') if slides else [], 1):
- slides_info.append((
- slide_id, xpath_text(slide, './slideName', 'name'), '.jpg',
- int_or_none(xpath_text(slide, './timeSec', 'time'))))
+ if isinstance(slides, xml.etree.ElementTree.Element):
+ slide_url_template = 'https://cdn.slideslive.com/data/presentations/%s/slides/big/%s%s'
+ for slide_id, slide in enumerate(slides.findall('./slide')):
+ slides_info.append((
+ slide_id, xpath_text(slide, './slideName', 'name'), '.jpg',
+ int_or_none(xpath_text(slide, './timeSec', 'time'))))
chapters, thumbnails = [], []
if url_or_none(player_info.get('thumbnail')):