typetube-py
Python client library for the TypeTube streaming API.
Zero runtime dependencies. Uses standard Python libraries (urllib.request, concurrent.futures, dataclasses).
Features
- Native Protocol Buffers wire decoding (fast binary responses from /v1/resolve and /v1/search)
- Multi-worker chunked range downloading with fallback to single-stream download
- Stream resolution (/v1/resolve)
- Video search (/v1/search)
- Quota and usage inspection (/v1/usage)
- Support for API key authentication and custom endpoints
Installation
pip install typetube
Or install from source:
cd packages/typetube-py
pip install .
Quick Start
from typetube import create_client
client = create_client(
endpoint="https://typetube.xysushi.in",
api_key="your_api_key_here",
)
result = client.resolve("Rick Astley - Never Gonna Give You Up")
print(result.title)
print(result.author)
if result.best_audio:
print(result.best_audio.url)
client.download_audio(result, "track.m4a", workers=8)
Usage
Stream Resolution
Resolve YouTube videos by search query, video ID, or direct URL:
result = client.resolve("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
print(f"Title: {result.title}")
print(f"Duration: {result.duration_seconds}s")
if result.best_audio:
print(f"Best Audio Bitrate: {result.best_audio.bitrate} bps")
print(f"Best Audio URL: {result.best_audio.url}")
Search
Search for tracks:
results = client.search("Hans Zimmer Interstellar", limit=5)
for item in results:
print(f"{item.title} ({item.duration}) - {item.url}")
Parallel Chunked Audio Download
Download audio with multi-worker parallel HTTP range requests:
download_res = client.download_audio(
result,
output_path="never_gonna_give_you_up.m4a",
workers=8,
chunk_size=1048576,
)
print(f"Downloaded {download_res.bytes_written} bytes to {download_res.path}")
print(f"Average speed: {download_res.average_speed_mbps:.2f} MB/s")
Quota and Usage
Inspect quota limits and remaining calls:
usage = client.usage()
print(f"IP: {usage.ip}")
print(f"Tier: {usage.tier}")
print(f"Resolve remaining: {usage.resolve_remaining}/{usage.resolve_limit}")
print(f"Reset in: {usage.reset_seconds}s")
License
MIT
Metadata
Release files for typetube 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| typetube-0.1.0.tar.gz | 8.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| typetube-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.1 kB
Release files / typetube-0.1.0.tar.gz
| Download URL | typetube-0.1.0.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e221b3418a9c66c97c5dd47f7f79d0a473ed7e4641d7d73fe379eeeee04fd8f
|
|
BLAKE2b-256 checksum How to use checksums |
b226481181a2b22bfb70f5572f9c50306c110a6c7849d4334f9787fde5e778b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / typetube-0.1.0-py3-none-any.whl
| Download URL | typetube-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
21615a10f8bb0b1f054cce03ab3ed9a6ea50ea6a64b615450b251d6edc455f0c
|
|
BLAKE2b-256 checksum How to use checksums |
90cc6fa79cb699ac04997a5e8774b65a5de3f2a307d6f602a4c3f498081a24fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|