This project provides a FastAPI-based service for transcribing YouTube videos. It uses the langchain_community.document_loaders.YoutubeLoader
to fetch and process video transcripts.
- Accepts a YouTube video URL and language code.
- Returns the full transcription of the video in the specified language.
- Built with FastAPI for high performance and easy deployment.
-
Clone the repository:
git clone https://github.com/your-username/Youtube-Transcript-API.git cd Youtube-Transcript-API
-
Create a virtual environment and activate it:
python3 -m venv venv source venv/bin/activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Start the FastAPI server:
uvicorn main:app --host 0.0.0.0 --port 8000
-
Use the
/transcribe
endpoint to get a video transcription:- Endpoint:
POST /transcribe
- Request Body:
{ "url": "https://www.youtube.com/watch?v=example", "language": "pt" }
- Response:
{ "transcription": "Full transcription of the video." }
- Endpoint:
You can test the API using curl
or any HTTP client like Postman:
curl -X POST "https://yt-transcript.leapcell.app/transcribe" \
-H "Content-Type: application/json" \
-d '{"url": "https://www.youtube.com/watch?v=example", "language": "pt"}'
fastapi
uvicorn
pydantic
langchain_community
This project is licensed under the MIT License.
Special thanks to the developers of FastAPI and LangChain for their amazing tools.