From 6f5a908dffa7a0ed51998355da7126fce69718ec Mon Sep 17 00:00:00 2001 From: grqx_wsl <173253225+grqx@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:45:03 +1300 Subject: [PATCH] fix heatmap extraction --- yt_dlp/extractor/bilibili.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/yt_dlp/extractor/bilibili.py b/yt_dlp/extractor/bilibili.py index 90505029df..3ac9c7cd00 100644 --- a/yt_dlp/extractor/bilibili.py +++ b/yt_dlp/extractor/bilibili.py @@ -74,11 +74,8 @@ class BilibiliBaseIE(InfoExtractor): query={'cid': cid}) if not isinstance(heatmap_json, dict): return - try: - duration = self._parse_json(heatmap_json['debug'])['max_time'] - except Exception: - duration = None - step_sec = heatmap_json.get('step_sec', {int}) + duration = self._parse_json(heatmap_json['debug']).get('max_time') + step_sec = traverse_obj(heatmap_json, ('step_sec', {int})) heatmap_data = traverse_obj(heatmap_json, ('events', 'default', {list})) if not step_sec or not heatmap_data: return