Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

How to put youtube captions in a list?

$
0
0

The "text" string contains the captions of the youtube video. How do I put these captions in separete lists per video.

videos = get_channel_videos(channel_id)video_ids = []  # list of all video_id of channelfor video in videos:    video_ids.append(video['snippet']['resourceId']['videoId'])for video_id in video_ids:    try:        responses = YouTubeTranscriptApi.get_transcript(            video_id, languages=['en'])        print('\n'+"Video: "+"https://www.youtube.com/watch?v="+str(video_id)+'\n'+'\n'+"Captions:")        for response in responses:            text = response['text']            print(text)    except Exception as e:       print(e)

Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>