Spleech (SpeechLeech) is a Flask-based web application that extracts and returns YouTube video transcripts using the YouTube Transcript API. It is designed to be hosted on Fly.io.
- Extracts transcripts from YouTube videos using video IDs or URLs.
- Provides a clean and concatenated transcript text.
- Includes CLI and REST API endpoints for interaction.
- Custom request session headers for better compatibility.
- Python 3.8+
- Docker (for deployment)
- Fly.io CLI
-
Clone the repository:
git clone <repository-url> cd spleech
-
Install dependencies:
pip install -r requirements.txt
-
Set up Fly.io:
- Run
flyctl launch
and follow the prompts. - Ensure the
fly.toml
file is correctly configured.
- Run
-
Run the application locally:
python app.py
- URL:
/
- Method:
GET
- Response:
{ "status": "App is running", "app_name": "spleech-rough-wildflower-5228" }
- URL:
/health
- Method:
GET
- Response:
{ "status": "healthy" }
- URL:
/transcript
- Method:
POST
- Request Body:
{ "video_id": "<YouTube Video ID>" }
- Response:
{ "transcript": "<Transcript Text>" }
Run the application in CLI mode to fetch a YouTube video transcript directly:
python app.py cli <video_id>
Example:
python app.py cli dQw4w9WgXcQ
-
Run tests locally:
./run_test_locally.sh
-
Run tests in the deployment environment:
./run_test.sh
-
Build the Docker image:
docker build -t spleech .
-
Deploy the app using Fly.io:
./deploy.sh
-
Verify the app status:
fly status
app.py
: Core application logic.Dockerfile
: Docker configuration for containerizing the app.fly.toml
: Configuration for Fly.io deployment.cookies.txt
: Placeholder for cookies (if required by YouTube API).deploy.sh
: Script for deployment.run_test.sh
: Script for testing in the deployment environment.run_test_locally.sh
: Script for testing locally.startup.sh
: Initialization script for app startup.test.py
: Contains test cases for the app.
Feel free to fork the repository and make contributions. Submit a pull request with a detailed explanation of the changes.
This project is licensed under the MIT License. See the LICENSE file for details.
Happy transcripting with Spleech!