Spaces:
Sleeping
Sleeping
Update src/utils/helper.py
Browse files- src/utils/helper.py +3 -1
src/utils/helper.py
CHANGED
|
@@ -118,12 +118,14 @@ async def preprocess_messages(query: str, attachs: list[UploadFile]):
|
|
| 118 |
# transcript_str += trans.text + " "
|
| 119 |
# logger.info(f"Transcript: {transcript_str}")
|
| 120 |
# return transcript_str
|
|
|
|
| 121 |
|
|
|
|
| 122 |
import os
|
| 123 |
def extract_transcript(video_link: str):
|
| 124 |
try:
|
| 125 |
# extract video id from video link
|
| 126 |
-
video_id = video_link
|
| 127 |
|
| 128 |
api_key = os.getenv("SUPADATA_API_KEY")
|
| 129 |
if not api_key:
|
|
|
|
| 118 |
# transcript_str += trans.text + " "
|
| 119 |
# logger.info(f"Transcript: {transcript_str}")
|
| 120 |
# return transcript_str
|
| 121 |
+
def extract_video_id(video_link: str):
|
| 122 |
|
| 123 |
+
return video_link.replace("\u2069", "").split("v=")[1].strip()
|
| 124 |
import os
|
| 125 |
def extract_transcript(video_link: str):
|
| 126 |
try:
|
| 127 |
# extract video id from video link
|
| 128 |
+
video_id = extract_video_id(video_link)
|
| 129 |
|
| 130 |
api_key = os.getenv("SUPADATA_API_KEY")
|
| 131 |
if not api_key:
|