The https://yt.lemnoslife.com
service has been discontinued due to violations of the YouTube Terms of Service, as per a notice received on October 4, 2024 from the YouTube Legal Team. The endpoints relying on this service are now deprecated and may no longer function as intended. See the relevant discussion here
# YouTube Channel & Video API
Effortlessly access YouTube channel details, recent videos, video statistics, and transcripts with this Flask-based API. Designed for simplicity and efficiency, this tool helps you retrieve comprehensive YouTube data quickly.
## Features
- **Channel Information:** Get details about a YouTube channel, including title, description, and subscriber count.
- **Recent Videos:** Fetch the latest video URL from a specified channel.
- **Video Statistics:** Retrieve video title and view count.
- **Transcripts:** Generate transcripts for YouTube videos with ease.
- **Caching:** Utilizes caching to improve response times and reduce API load.
- **Error Handling:** Provides meaningful error messages for better debugging and user experience.
- **Flexible Querying:** Supports dynamic requests for various YouTube data using channel and video IDs.
- **Multiple Video Support:** Retrieve statistics for multiple videos at once by passing a list of video IDs.
## How It Works
### 1. Channel Info
**Endpoint:** `/channel`
**Method:** `GET`
**Query Parameter:**
- `id`: YouTube channel ID
**Example Request:**
```bash
curl "http://localhost:5000/channel?id=CHANNEL_ID"
Response:
{
"title": "Channel Title",
"description": "Channel Description",
"subscribers": "Subscriber Count"
}
Endpoint: /recentvid
Method: GET
Query Parameter:
id
: YouTube channel ID
Example Request:
curl "http://localhost:5000/recentvid?id=CHANNEL_ID"
Response:
{
"videoUrl": "https://www.youtube.com/watch?v=VIDEO_ID"
}
Endpoint: /stats
Method: GET
Query Parameter:
id
: YouTube video ID
Example Request:
curl "http://localhost:5000/stats?id=VIDEO_ID"
Response:
{
"title": "Video Title",
"viewCount": "View Count"
}
Endpoint: /transcript
Method: GET
Query Parameter:
id
: YouTube video ID
Example Request:
curl "http://localhost:5000/transcript?id=VIDEO_ID"
Response:
{
"transcript": "Transcript Text"
}
The API includes robust error handling, returning meaningful error messages when:
- No ID is provided
- The specified channel or video is not found
- An unexpected error occurs
- Backend: Flask, Flask-Caching
- APIs: YouTube Data API, Kome AI for transcripts
To get started with the YouTube Channel & Video API, follow these installation steps:
-
Clone the Repository
git clone https://github.com/RojanSapkota/YouTubeStatsAPI.git cd YouTubeStatsAPI
-
Create a Virtual Environment (optional but recommended)
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install Required Packages
pip install Flask Flask-Caching requests
-
Run the Application
python main.py
The API will be available at http://localhost:5000
.
This project is licensed under the MIT License. See the LICENSE file for details.
For any questions or feedback, please contact Rojan.
### Key Corrections Made:
- Clarified some sentences for better readability.
- Ensured consistent formatting throughout.
- Maintained clarity in API functionality descriptions.
Feel free to use or modify it as needed!