Skip to main content

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.com and youtu.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', 'tr'],  # Priority languages
    as_dict=False  # Return transcript as plain text
)

API Reference

YouTubeAPI Class

YouTubeAPI(url: str)

Initialize the API with a YouTube video URL.

data() -> dict

Returns video metadata dictionary containing:

  • video_id: YouTube video ID
  • title: Video title
  • img_url: Thumbnail URL
  • short_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', 'tr'])
  • 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 format
  • NoVideoFound: Video not accessible or doesn't exist
  • NoTranscriptFound: 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple_yt_api-1.0.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_yt_api-1.0.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file simple_yt_api-1.0.1.tar.gz.

File metadata

  • Download URL: simple_yt_api-1.0.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for simple_yt_api-1.0.1.tar.gz
Algorithm Hash digest
SHA256 47c38ae851c895d24a6460cc74c8d7aafce2796855a5a3534316cbba16125d87
MD5 d9d582b35e07825b21793709219f9aa2
BLAKE2b-256 ec704e1d76905e6f59d23e0497b7018a013929094ff214a91043a00e3a0909dc

See more details on using hashes here.

File details

Details for the file simple_yt_api-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: simple_yt_api-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for simple_yt_api-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 873cdf506d21b751a446ba99c9593ef64d23233f17afe51f9aa5462b9e9ae1e4
MD5 bc3f20f2d788f1c14c35e891a7519b0c
BLAKE2b-256 d496a7c27159ffbb183184cfe4695338aa19ded05c01cb9a140d88b6b6b6518e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page