Feb-15-2020, 09:55 PM
(Feb-15-2020, 10:03 AM)DeaD_EyE Wrote: They keyvideo_id
is not intranscript
.
Replace line 14:
transcript.video_id,
withvideo_id,
Then try again.
If the next error occurs, you know that this attribute is also not provided by the current transcript element.
Thanks for your reply. Yes, that fixed it, but I had to also remove all of those other attributes. Possibly I need to make sure that package has those attributes. Have been adding extra code to the other script, so that it writes to a file and prints; helps understand the data coming back.
#!/usr/bin/python from youtube_transcript_api import YouTubeTranscriptApi video_id = 'My3QHayBBfQ' transcript_list = YouTubeTranscriptApi.get_transcript(video_id) print(transcript_list[0]) print(transcript_list[1]) print(transcript_list[2]) with open('your_file.txt', 'w') as f: for item in transcript_list: f.write("%s\n" % item)Is there a debug feature with python ? I'm used to stepping through code and examining variables, etc.