ysharma HF staff coyotte508 HF staff commited on
Commit
90a4d51
1 Parent(s): 5862540

Handle video urls with timestamps / other query parameters in them (#3)

Browse files

- Handle video urls with timestamps / other query parameters in them (b8572efbb49dc2086b85046d7a65dc209e140ff3)


Co-authored-by: Eliott Coyac <coyotte508@users.noreply.huggingface.co>

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])