Spaces:
Sleeping
Sleeping
kasper-boy
commited on
Update app.py
Browse files
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 |
-
#
|
17 |
-
regex = r"(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v
|
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)
|