Update app.py
Browse files
app.py
CHANGED
|
@@ -518,15 +518,13 @@ def google_translate(q: str, from_: Optional[str] = 'auto', to: str = "en"):
|
|
| 518 |
|
| 519 |
@app.get("/api/youtube/transcript")
|
| 520 |
async def youtube_transcript(
|
| 521 |
-
|
| 522 |
-
languages: str = "en",
|
| 523 |
preserve_formatting: bool = False,
|
| 524 |
proxy: Optional[str] = None # Add proxy parameter
|
| 525 |
):
|
| 526 |
"""Get the transcript of a YouTube video."""
|
| 527 |
try:
|
| 528 |
-
|
| 529 |
-
transcript = YTTranscriber.get_transcript(video_id, languages=languages_list, preserve_formatting=preserve_formatting, proxies=proxy)
|
| 530 |
return JSONResponse(content=jsonable_encoder(transcript))
|
| 531 |
except Exception as e:
|
| 532 |
raise HTTPException(status_code=500, detail=f"Error getting YouTube transcript: {e}")
|
|
|
|
| 518 |
|
| 519 |
@app.get("/api/youtube/transcript")
|
| 520 |
async def youtube_transcript(
|
| 521 |
+
video_url: str,
|
|
|
|
| 522 |
preserve_formatting: bool = False,
|
| 523 |
proxy: Optional[str] = None # Add proxy parameter
|
| 524 |
):
|
| 525 |
"""Get the transcript of a YouTube video."""
|
| 526 |
try:
|
| 527 |
+
transcript = YTTranscriber.get_transcript(video_url, preserve_formatting=preserve_formatting, proxies=proxy)
|
|
|
|
| 528 |
return JSONResponse(content=jsonable_encoder(transcript))
|
| 529 |
except Exception as e:
|
| 530 |
raise HTTPException(status_code=500, detail=f"Error getting YouTube transcript: {e}")
|