CVstation commited on
Commit
ff96138
1 Parent(s): 06a7421

Upload subtitles.py

Browse files
Files changed (1) hide show
  1. subtitles.py +16 -0
subtitles.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from youtube_transcript_api import YouTubeTranscriptApi
2
+ import pytube as py
3
+
4
+ def Get_Video_Id(url):
5
+ id=py.extract.video_id(url)
6
+ return id
7
+
8
+ def Video_To_Text(video_url):
9
+ video_text=" "
10
+ i=0
11
+ video_id=Get_Video_Id(video_url)
12
+ video_data=YouTubeTranscriptApi.get_transcript(video_id)
13
+ for data in video_data:
14
+ video_text=video_text+" "+video_data[i].get("text")
15
+ i=i+1
16
+ return video_text