A simple and easy-to-use YouTube API Wrapper
Project description
Simple YouTube API
A lightweight Python wrapper for extracting video metadata and transcripts from YouTube videos.
Features
- 🎥 Extract video metadata (title, thumbnail, description)
- 📝 Get video transcripts in multiple languages
- ⚡ Simple and easy to use interface
- 🔒 No API key required
- 🌐 Support for both YouTube URL formats (
youtube.comandyoutu.be)
Installation
pip install simple-yt-api
Quick Start
from simple_yt_api import YouTubeAPI
# Initialize with a YouTube URL
url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
yt = YouTubeAPI(url)
# Get video metadata
metadata = yt.data()
print(metadata['title'])
# Get video transcript
transcript = yt.get_transcript(languages=['en']) # Get English transcript
print(transcript)
# Get both metadata and transcript at once
data, transcript = yt.get_video_data_and_transcript(
languages=['en', 'es'], # Priority languages
as_dict=False # Return transcript as plain text
)
API Reference
YtAPI Class
YtAPI(url: str)
Initialize the API with a YouTube video URL.
data() -> dict
Returns video metadata dictionary containing:
video_id: YouTube video IDtitle: Video titleimg_url: Thumbnail URLshort_description: Video description
get_transcript(languages: list = [], as_dict: bool = False) -> str | dict
Get video transcript in specified languages.
languages: List of language codes (e.g., ['en', 'es'])as_dict: If True, returns timestamp dictionary format
get_video_data_and_transcript(languages: list = [], as_dict: bool = False) -> tuple
Get both metadata and transcript in one call.
Error Handling
The library includes custom exceptions:
NotValidURL: Invalid YouTube URL formatNoVideoFound: Video not accessible or doesn't existNoTranscriptFound: No transcript available for the video
Requirements
- Python 3.7+
- requests
- beautifulsoup4
- youtube-transcript-api
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simple_yt_api-1.0.0.tar.gz.
File metadata
- Download URL: simple_yt_api-1.0.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd40204d14f804513eec437831a390a616b1e0c9d60e34db4c27a2744082a98e
|
|
| MD5 |
34cc44f6372875678c9e00e2896386e3
|
|
| BLAKE2b-256 |
df76730b6d3609a17c1885f2e39db0cf465ba625c17aca7961429fbe1e4cc66c
|
File details
Details for the file simple_yt_api-1.0.0-py3-none-any.whl.
File metadata
- Download URL: simple_yt_api-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61a831946111ae48c0721b6843a3a20c62e0bfba5cef96ad2639b17558f7cdfc
|
|
| MD5 |
f5dce6c9967eb0120d3e3fa5438c0c34
|
|
| BLAKE2b-256 |
a724ae6681c53912048412a45ad94e91028f0352f6cde40a336574776665210c
|