shikharyashmaurya
commited on
Commit
•
84c1d11
1
Parent(s):
9a11def
Update app.py
Browse files
app.py
CHANGED
@@ -5,14 +5,6 @@ import google.generativeai as genai
|
|
5 |
|
6 |
import re
|
7 |
|
8 |
-
# def extract_video_id(url):
|
9 |
-
# # Regular expression pattern to match the video ID
|
10 |
-
# pattern = r'(?<=/|v=|vi/|youtu\.be/|embed/)[^#&?]*'
|
11 |
-
# match = re.search(pattern, url)
|
12 |
-
# if match:
|
13 |
-
# return match.group(0)
|
14 |
-
# else:
|
15 |
-
# return None
|
16 |
|
17 |
def parseYoutubeURL(url):
|
18 |
url=str(url)
|
@@ -21,8 +13,6 @@ def parseYoutubeURL(url):
|
|
21 |
return data[0]
|
22 |
return ""
|
23 |
|
24 |
-
|
25 |
-
|
26 |
from youtube_transcript_api import YouTubeTranscriptApi
|
27 |
|
28 |
secret_key = os.getenv("SECRET_KEY")
|
@@ -37,8 +27,7 @@ within 250 words. Please provide the summary of the text given here: """
|
|
37 |
## getting the transcript data from yt videos
|
38 |
def extract_transcript_details(youtube_video_url):
|
39 |
try:
|
40 |
-
|
41 |
-
# video_id=extract_video_id(youtube_link)
|
42 |
video_id=parseYoutubeURL(youtube_link)
|
43 |
|
44 |
transcript_text=YouTubeTranscriptApi.get_transcript(video_id)
|
@@ -63,8 +52,7 @@ st.title("YouTube Transcript to Detailed Notes Converter")
|
|
63 |
youtube_link = st.text_input("Enter YouTube Video Link:")
|
64 |
|
65 |
if youtube_link:
|
66 |
-
|
67 |
-
# video_id=extract_video_id(youtube_link)
|
68 |
video_id=parseYoutubeURL(youtube_link)
|
69 |
print(video_id)
|
70 |
st.image(f"http://img.youtube.com/vi/{video_id}/0.jpg", use_column_width=True)
|
|
|
5 |
|
6 |
import re
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
def parseYoutubeURL(url):
|
10 |
url=str(url)
|
|
|
13 |
return data[0]
|
14 |
return ""
|
15 |
|
|
|
|
|
16 |
from youtube_transcript_api import YouTubeTranscriptApi
|
17 |
|
18 |
secret_key = os.getenv("SECRET_KEY")
|
|
|
27 |
## getting the transcript data from yt videos
|
28 |
def extract_transcript_details(youtube_video_url):
|
29 |
try:
|
30 |
+
|
|
|
31 |
video_id=parseYoutubeURL(youtube_link)
|
32 |
|
33 |
transcript_text=YouTubeTranscriptApi.get_transcript(video_id)
|
|
|
52 |
youtube_link = st.text_input("Enter YouTube Video Link:")
|
53 |
|
54 |
if youtube_link:
|
55 |
+
|
|
|
56 |
video_id=parseYoutubeURL(youtube_link)
|
57 |
print(video_id)
|
58 |
st.image(f"http://img.youtube.com/vi/{video_id}/0.jpg", use_column_width=True)
|