fixing long links
Browse files
App/Transcription/TranscriptionRoutes.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
from fastapi import APIRouter, status, Depends, UploadFile, File, Query, BackgroundTasks
|
2 |
from typing_extensions import Annotated
|
|
|
3 |
from .Schemas import (
|
4 |
UserDetails,
|
5 |
TranscriptionMetadata,
|
@@ -37,6 +38,15 @@ async def download_audio(
|
|
37 |
),
|
38 |
user: UserSchema = Depends(get_token_owner),
|
39 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
if user == None:
|
41 |
return {"code": 400, "message": "doesn't exist", "payload": None}
|
42 |
|
|
|
1 |
from fastapi import APIRouter, status, Depends, UploadFile, File, Query, BackgroundTasks
|
2 |
from typing_extensions import Annotated
|
3 |
+
from urllib.parse import urlparse, parse_qs
|
4 |
from .Schemas import (
|
5 |
UserDetails,
|
6 |
TranscriptionMetadata,
|
|
|
38 |
),
|
39 |
user: UserSchema = Depends(get_token_owner),
|
40 |
):
|
41 |
+
youtube_url= url
|
42 |
+
parsed_url = urlparse(youtube_url)
|
43 |
+
|
44 |
+
# Get the query parameters
|
45 |
+
query_parameters = parse_qs(parsed_url.query)
|
46 |
+
|
47 |
+
# Get the value of the 'v' parameter
|
48 |
+
v_param_value = query_parameters.get('v', [])[0] if 'v' in query_parameters else None
|
49 |
+
url = f"https://www.youtube.com/watch?v={v_param_value}"
|
50 |
if user == None:
|
51 |
return {"code": 400, "message": "doesn't exist", "payload": None}
|
52 |
|