Skip to content

Commit d2e3f8a

Browse files
Add explicit output format instructions to chapters prompt
- Instruct AI to output only the chapter list without preamble text - Prevent conversational phrases like 'Here are the chapters' or 'Sure, I'll help' - Addresses reviewer feedback to handle this in the prompt rather than post-processing
1 parent 4b1f380 commit d2e3f8a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

video-transcripts/transcripts.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def get_video_transcript_with_retry(video_id, max_retries=5):
315315
if 'blocking requests from your IP' in error_str or 'IP has been blocked' in error_str:
316316
print(f"❌ YouTube IP block detected for video {video_id}")
317317
print(f" See README 'YouTube IP Blocking' section for solutions")
318-
return None, None
318+
return None, None´
319319
elif '429' in error_str or 'Too Many Requests' in error_str:
320320
if attempt < max_retries - 1:
321321
wait_time = random.uniform(60, 120)
@@ -1006,7 +1006,15 @@ def create_chapters(transcript, video_id, raw_transcript=None, summary=None):
10061006
- Be precise and honest about what's happening at each moment
10071007
- KEEP DESCRIPTIONS CONCISE: Use 2-6 words maximum, not full sentences
10081008
- Descriptions should be SHORT PHRASES like "Guest introduction", "Discussion about X", "Demo of Y feature"
1009-
- DO NOT write full sentences or lengthy explanations in the chapter titles{duration_constraint}{summary_context}{timeline_context}
1009+
- DO NOT write full sentences or lengthy explanations in the chapter titles
1010+
1011+
OUTPUT FORMAT REQUIREMENTS:
1012+
- Output ONLY the chapter list, nothing else
1013+
- Start directly with the first timestamp line: "00:00:00 Introductions"
1014+
- Do NOT include any preamble, introduction, or explanatory text before the chapters
1015+
- Do NOT say things like "Here are the chapters", "Sure, I'll help", or "Here are 10 key moments"
1016+
- Do NOT add any text after the last chapter
1017+
- Just provide the raw chapter list in the specified format{duration_constraint}{summary_context}{timeline_context}
10101018
"""
10111019

10121020
print(f"Creating chapters for video {video_id}")

0 commit comments

Comments
 (0)