wendru18 commited on
Commit
e82393a
·
1 Parent(s): f44d114

changed mobile link fix

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -29,10 +29,7 @@ def set_openai_key(key):
29
 
30
  def get_youtube_data(url):
31
 
32
- if "youtu.be" in url:
33
- video_id = url.split("/")[-1]
34
- else:
35
- video_id = url.split("=")[1]
36
 
37
  try:
38
  raw = YouTubeTranscriptApi.get_transcript(video_id)
@@ -222,6 +219,10 @@ def main(openAI_key, urls_text, question, split_by_topic, segment_length, n_neig
222
  segments = []
223
 
224
  for url in urls:
 
 
 
 
225
  df, title, author = get_youtube_data(url)
226
 
227
  title = add_to_dict(title, url)
 
29
 
30
  def get_youtube_data(url):
31
 
32
+ video_id = url.split("=")[1]
 
 
 
33
 
34
  try:
35
  raw = YouTubeTranscriptApi.get_transcript(video_id)
 
219
  segments = []
220
 
221
  for url in urls:
222
+
223
+ if "youtu.be" in url:
224
+ url = url.replace("youtu.be", "youtube.com/watch?v=")
225
+
226
  df, title, author = get_youtube_data(url)
227
 
228
  title = add_to_dict(title, url)