YouTube videolarını otomatik olarak çıkarıp AI ile çeviren güçlü Python kütüphanesi
Project description
🎬 U-Transkript
Powerful Python library to automatically extract and translate YouTube videos with AI
U-Transkript is a modern and user-friendly Python package that extracts transcripts (subtitles) from YouTube videos and translates them into your desired language using Google Gemini AI. It offers an excellent solution for education, research, content creation, and much more.
✨ Features
🤖 AI-Powered Translation - High-quality translations with Google Gemini AI 🌍 Multi-Language Support - Ability to translate into 50+ languages 📊 Flexible Output Formats - Get results in TXT, JSON, XML formats 🔗 Method Chaining - Easy to use with chained function calls ⚡ Fast and Efficient - Optimized performance 🛡️ Secure - Error handling and secure API calls 📝 Detailed Documentation - Comprehensive user guide
🚀 Quick Start
Installation
pip install u-transkript
Basic Usage
from u_transkript import AITranscriptTranslator
# Create Translator
translator = AITranscriptTranslator("YOUR_GEMINI_API_KEY")
# Translate Video
result = translator.set_lang("English").translate_transcript("dQw4w9WgXcQ")
print(result)
Advanced Usage with Method Chaining
# Set all settings at once
result = (translator
.set_model("gemini-2.5-flash")
.set_lang("English")
.set_type("json")
.translate_transcript("VIDEO_ID"))
📖 Detailed Documentation
Main Functions
| Function | Description | Example |
|---|---|---|
set_model(model) |
Set the Gemini model | translator.set_model("gemini-2.5-flash") |
set_api(api_key) |
Set the API key | translator.set_api("YOUR_API_KEY") |
set_lang(language) |
Set the target language | translator.set_lang("English") |
set_type(format) |
Set the output format | translator.set_type("json") |
translate_transcript(video_id) |
Main translation function | translator.translate_transcript("VIDEO_ID") |
Supported Output Formats
📄 TXT Format
translator.set_type("txt")
# Output: "Hello, this is an example translation..."
📋 JSON Format
translator.set_type("json")
# Output: Structured JSON data (with metadata)
🏷️ XML Format
translator.set_type("xml")
# Output: Full data structure in XML format
Supported Languages
🇹🇷 Turkish • 🇺🇸 English • 🇪🇸 Spanish • 🇫🇷 French • 🇩🇪 German • 🇮🇹 Italian • 🇵🇹 Portuguese • 🇷🇺 Russian • 🇯🇵 Japanese • 🇰🇷 Korean • 🇨🇳 Chinese • 🇸🇦 Arabic
💡 Use Cases
📰 News Content
# Translating news videos
result = translator.set_lang("English").translate_transcript("NEWS_VIDEO_ID")
💼 Business Presentations
# Translating technical presentations
result = translator.set_type("json").translate_transcript("PRESENTATION_ID")
🎬 Content Creation
# Translating YouTube content into different languages
video_ids = ["VIDEO1", "VIDEO2", "VIDEO3"]
for video_id in video_ids:
result = translator.set_lang("English").translate_transcript(video_id)
with open(f"{video_id}_en.txt", "w") as f:
f.write(result)
🔧 Advanced Features
Custom Prompt Usage
custom_prompt = """
Please translate this text into {language}:
- Preserve technical terms
- Use natural language
- Maintain context
Text: {text}
"""
result = translator.translate_transcript(
"VIDEO_ID",
custom_prompt=custom_prompt
)
Batch Processing
videos = ["VIDEO1", "VIDEO2", "VIDEO3"]
results = []
for video in videos:
try:
result = translator.set_lang("English").translate_transcript(video)
results.append({"video": video, "translation": result})
except Exception as e:
results.append({"video": video, "error": str(e)})
Saving to File
# Saving in JSON format
result = translator.set_type("json").translate_transcript("VIDEO_ID")
with open("translation.json", "w", encoding="utf-8") as f:
f.write(result)
📊 Performance
| Model | Speed | Quality | Usage |
|---|---|---|---|
gemini-2.0-flash-exp |
⚡⚡⚡ | ⭐⭐⭐ | Fast translations |
gemini-2.5-flash |
⚡⚡ | ⭐⭐⭐⭐ | Balanced performance |
gemini-pro |
⚡ | ⭐⭐⭐⭐⭐ | Highest quality |
🔍 Troubleshooting
Common Errors
API Key Error
# ❌ Incorrect
translator = AITranscriptTranslator("")
# ✅ Correct
translator = AITranscriptTranslator("VALID_API_KEY")
Video Not Found
# Ensure the Video ID is correct
video_id = "dQw4w9WgXcQ" # 11 characters
Language Error
# ❌ Incorrect
translator.set_lang("en")
# ✅ Correct
translator.set_lang("English")
Debug Mode
import logging
logging.basicConfig(level=logging.DEBUG)
try:
result = translator.translate_transcript("VIDEO_ID")
except Exception as e:
print(f"Error: {e}")
📈 Roadmap
- v1.1.0 - Batch processing support
- v1.2.0 - Caching system
- v1.3.0 - CLI interface
- v1.4.0 - Web interface
- v1.5.0 - Support for more AI models
🤝 Contributing
We welcome your contributions!
- Fork it
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License. See the LICENSE file for details.
📞 Contact
- GitHub: u-transkript
- PyPI: u-transkript
- Documentation: example.md
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 u_transkript-1.1.0.tar.gz.
File metadata
- Download URL: u_transkript-1.1.0.tar.gz
- Upload date:
- Size: 23.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97b9fea834103b717b2c303bee1204017cc6b844b428ed827d9b0ec72f1631c3
|
|
| MD5 |
5edc5276e2683d9d2b84ca924a9dd73c
|
|
| BLAKE2b-256 |
17a3896080a30c4d9ddb9e049a2b4c7d5727a499ac0470a2fff5ce3944ecd379
|
File details
Details for the file u_transkript-1.1.0-py3-none-any.whl.
File metadata
- Download URL: u_transkript-1.1.0-py3-none-any.whl
- Upload date:
- Size: 22.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d2d92b4c8f5985beb0a0cabfa65fe0cd3e84d3b56d4c311a03aa64ef4812a63
|
|
| MD5 |
d7e8033bd8431d9d3c7e3ef25b44bbfe
|
|
| BLAKE2b-256 |
80559b25eb7ac01a010300a8714c019b91c2bc2fad6e3084cbdcc1b3c9e6b0aa
|