Skip to main content

A Python package to extract and clean YouTube video transcripts easily.

Project description

Youtube Transcript Extractor

A lightweight Python package to extract and process YouTube video transcripts using the youtube-transcript-api.


Features

  • Extract YouTube video ID from a URL (youtu.be or youtube.com).
  • Fetch raw transcripts from YouTube videos.
  • Clean transcripts into a structured format (text, start, duration, end).
  • Get plain transcript text for analysis or processing.

Installation

Install directly from PyPI:

pip install youtube-transcript-extractor

Or install from source (development mode):

git clone https://github.com/your-username/Youtube-Transcript-Extractor.git
cd Youtube-Transcript-Extractor
pip install -e .

Usage

Import the package

from youtube_transcript_extractor import YoutubeTranscriptExtractor

Example

# Initialize with a YouTube URL
yt = YoutubeTranscriptExtractor("https://youtu.be/dQw4w9WgXcQ")

# 1. Extract video ID
print(yt.extract_youtube_video_id())
# Output: dQw4w9WgXcQ

# 2. Get raw transcript
print(yt.extract_transcript()[:2])
# Output:
# [
#   {'text': "We're no strangers to love", 'start': 7.58, 'duration': 4.12},
#   {'text': "You know the rules and so do I", 'start': 11.70, 'duration': 4.26}
# ]

# 3. Get cleaned transcript
print(yt.clean_transcript()[:2])
# Output:
# [
#   {'text': "We're no strangers to love", 'start': 7.58, 'duration': 4.12, 'end': 11.70},
#   {'text': "You know the rules and so do I", 'start': 11.70, 'duration': 4.26, 'end': 15.96}
# ]

# 4. Get transcript as plain text
print(yt.get_transcript_text()[:100])
# Output: "We're no strangers to love You know the rules and so do I ..."

Requirements

  • Python >= 3.9
  • Dependencies:
    • youtube-transcript-api
    • urllib3
    • requests

Project Links


License

MIT License © 2025 54gO

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

youtube_transcript_extractor-0.1.3.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

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

youtube_transcript_extractor-0.1.3-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file youtube_transcript_extractor-0.1.3.tar.gz.

File metadata

File hashes

Hashes for youtube_transcript_extractor-0.1.3.tar.gz
Algorithm Hash digest
SHA256 24c270a854a580bdd186cf7202d0ffec3f3a5b349180f300c610c4da6fface03
MD5 6ce87a834d0d5468510330443d986978
BLAKE2b-256 3430a53438561769178f5b652c98301bd329072396c8c8955b4f5b4c85a3c925

See more details on using hashes here.

File details

Details for the file youtube_transcript_extractor-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for youtube_transcript_extractor-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4225433e5f2ea799ab5fb7a235f9a7d23b082c601bbaa32d9a89657920ecf62c
MD5 0019c7231a2e5b79ec6850610c901793
BLAKE2b-256 0ddc31443e58cff411d471b198942ff1e9d488e645e4eb0ac078dcb2cdfb6a6c

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