Update app.py
Browse files
app.py
CHANGED
@@ -226,9 +226,10 @@ def get_video_id(youtube_url):
|
|
226 |
|
227 |
def get_transcript(video_id):
|
228 |
tran = []
|
229 |
-
|
230 |
-
|
231 |
-
|
|
|
232 |
return ' '.join(tran)
|
233 |
|
234 |
|
|
|
226 |
|
227 |
def get_transcript(video_id):
|
228 |
tran = []
|
229 |
+
transcript_list = YouTubeTranscriptApi.list_transcripts(video_id)
|
230 |
+
transcript = transcript_list.find_transcript(['en'])
|
231 |
+
translated_transcript = transcript.translate('en')
|
232 |
+
tran += [t['text'] for t in translated_transcript.fetch() if t['text'] != '[music]']
|
233 |
return ' '.join(tran)
|
234 |
|
235 |
|