kasper-boy commited on
Commit
5dad971
1 Parent(s): 3b2fd95

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -12,9 +12,17 @@ def summary(text_youtube):
12
  output = text_summary(text_youtube)
13
  return output[0]['summary_text']
14
 
 
 
 
 
 
 
 
 
15
  def extract_video_id(url):
16
- # Regex to extract the video ID from various YouTube URL formats
17
- regex = r"(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})"
18
  match = re.search(regex, url)
19
  if match:
20
  return match.group(1)
 
12
  output = text_summary(text_youtube)
13
  return output[0]['summary_text']
14
 
15
+ # def extract_video_id(url):
16
+ # # Regex to extract the video ID from various YouTube URL formats
17
+ # regex = r"(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})"
18
+ # match = re.search(regex, url)
19
+ # if match:
20
+ # return match.group(1)
21
+ # return None
22
+
23
  def extract_video_id(url):
24
+ # Updated regex to extract the video ID from various YouTube URL formats, including /shorts/ and others with parameters
25
+ regex = r"(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})"
26
  match = re.search(regex, url)
27
  if match:
28
  return match.group(1)