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

Returns both video metadata and transcript for a YouTube video in one call without worrying about errors.

Error Handling

The library includes custom exceptions:

  • InvalidURL: Invalid YouTube URL format
  • NoVideoFound: Video not accessible or doesn't exist
  • NoTranscriptFound: No transcript available for the video

Requirements

  • requests>=2.32.3
  • beautifulsoup4>=4.13.3
  • youtube-transcript-api>=0.6.3

Disclaimer

This is an unofficial tool created by independent developers with no affiliation to any video platforms. The creators take no responsibility for how it is used. Users must ensure their usage complies with applicable terms of service and laws. The package may stop working if underlying platforms change their structure. Use at your own risk.

License

This project is licensed under the MIT License.

Links

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.1.2.tar.gz (4.8 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.1.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for simple_yt_api-1.1.2.tar.gz
Algorithm Hash digest
SHA256 952af5bfc437bf5f214da8424728c618d68952df0860f7a13470a700a112dca2
MD5 fb30957ac9cca6198767f14372fe8392
BLAKE2b-256 0cee6b13d31c3d4b62cb2b976721d06dc6ef24c65d9de5512dc4457648483435

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for simple_yt_api-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d213f8a4a3d3c63c1c750d585d35e098d2e401ba75369bad77c926047df01aec
MD5 1b4d84dce0ee2d4d8ff55dfae80efbc4
BLAKE2b-256 12bf536a2937dd7b3fc5a8d3ab2266a5d79932b41bf623c9ab132a3762c521dc

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