coyotte508 HF staff commited on
Commit
b8572ef
·
1 Parent(s): 5862540

Handle video urls with timestamps / other query parameters in them

Browse files

Maybe this will fix the issue reported in #1

Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -17,6 +17,8 @@ def get_transcript(link):
17
  print("******** Inside get_transcript ********")
18
  print(f"link to be extracted is : {link}")
19
  video_id = link.split("=")[1]
 
 
20
  print(f"video id extracted is : {video_id}")
21
  transcript = YouTubeTranscriptApi.get_transcript(video_id)
22
  FinalTranscript = ' '.join([i['text'] for i in transcript])
 
17
  print("******** Inside get_transcript ********")
18
  print(f"link to be extracted is : {link}")
19
  video_id = link.split("=")[1]
20
+ # Handle additional query parameters such as timestamp, ...
21
+ video_id = video_id.split("&")[0]
22
  print(f"video id extracted is : {video_id}")
23
  transcript = YouTubeTranscriptApi.get_transcript(video_id)
24
  FinalTranscript = ' '.join([i['text'] for i in transcript])