Spaces:
Runtime error
Runtime error
File size: 490 Bytes
6d3aa82 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
from youtube_transcript_api import YouTubeTranscriptApi
import sys
def check_transcript(video_id):
try:
print(f"Fetching transcript for: {video_id}")
t = YouTubeTranscriptApi().fetch(video_id)
print("SUCCESS! Transcript found.")
print(f"Elements: {len(t)}")
print(f"First 5 lines: {[i.text for i in t[:5]]}")
except Exception as e:
print(f"FAILED: {e}")
if __name__ == "__main__":
vid = "WIZf-Doc8Bk"
check_transcript(vid)
|