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.beoryoutube.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-apiurllib3requests
Project Links
- Source Code: GitHub
- PyPI: Youtube Transcript Extractor
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
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 youtube_transcript_extractor-0.1.4.tar.gz.
File metadata
- Download URL: youtube_transcript_extractor-0.1.4.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dd0f620c9819079dea08da34054650e9949cc393eda3192148ec3840503e4a5
|
|
| MD5 |
dfa2ab31761083fed077dc392196dcb1
|
|
| BLAKE2b-256 |
7a60c97e3b5976c265d925ec88cc34c87d1a3569c686bbe3c3627fe34f2055f3
|
File details
Details for the file youtube_transcript_extractor-0.1.4-py3-none-any.whl.
File metadata
- Download URL: youtube_transcript_extractor-0.1.4-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77ff965d2168f7466b56d4ad5806d60f8f6f665e27d761c9f0e76b71e6ffbcd9
|
|
| MD5 |
f8a1be908a5800d627691e360c7034cc
|
|
| BLAKE2b-256 |
83ac9423d3c2dc1e9a084b22e2e0933a8283cb01069ba6a1895a53a34e32e69d
|