aboutsummaryrefslogtreecommitdiff
path: root/yt_dlp/extractor/common.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2023-04-16 03:16:23 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2023-04-16 08:55:43 +0530
commit84ffeb7d5e72e3829319ba7720a8480fc4c7503b (patch)
treeb727a0c09b78a75449b7b5f93102a4b80c1287b7 /yt_dlp/extractor/common.py
parent7666b93604b97e9ada981c6b04ccf5605dd1bd44 (diff)
[extractor] Do not warn for invalid chapter data in description
Fixes https://github.com/yt-dlp/yt-dlp/issues/6811#issuecomment-1509876209
Diffstat (limited to 'yt_dlp/extractor/common.py')
-rw-r--r--yt_dlp/extractor/common.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py
index 838899052..78288f809 100644
--- a/yt_dlp/extractor/common.py
+++ b/yt_dlp/extractor/common.py
@@ -3658,18 +3658,22 @@ class InfoExtractor:
'start_time': start_function(chapter),
'title': title_function(chapter),
} for chapter in chapter_list or []]
- if not strict:
+ if strict:
+ warn = self.report_warning
+ else:
+ warn = self.write_debug
chapter_list.sort(key=lambda c: c['start_time'] or 0)
chapters = [{'start_time': 0}]
for idx, chapter in enumerate(chapter_list):
if chapter['start_time'] is None:
- self.report_warning(f'Incomplete chapter {idx}')
+ warn(f'Incomplete chapter {idx}')
elif chapters[-1]['start_time'] <= chapter['start_time'] <= duration:
chapters.append(chapter)
elif chapter not in chapters:
- self.report_warning(
- f'Invalid start time ({chapter["start_time"]} < {chapters[-1]["start_time"]}) for chapter "{chapter["title"]}"')
+ issue = (f'{chapter["start_time"]} > {duration}' if chapter['start_time'] > duration
+ else f'{chapter["start_time"]} < {chapters[-1]["start_time"]}')
+ warn(f'Invalid start time ({issue}) for chapter "{chapter["title"]}"')
return chapters[1:]
def _extract_chapters_from_description(self, description, duration):