yt-cm — YouTube Cookie Manager
A CLI tool for managing YouTube authentication cookies in Netscape format. Validates cookie authenticity, refreshes sessions, and can run as a daemon to continuously keep sessions active.
Install
pip install yt-cm
Or install from source:
git clone https://github.com/daedalus/yt-cm.git
cd yt-cm
pip install -e .
Usage
CLI Commands
# Validate a cookie
yt-cm cookies.txt validate
# Renew session and show expiration info
yt-cm cookies.txt renew
# Check authentication cookie status
yt-cm cookies.txt auth-info
# Export cookies to new file
yt-cm cookies.txt export -o new_cookies.txt
# Run as daemon (background)
yt-cm cookies.txt daemon --interval 3600
# Run in foreground
yt-cm cookies.txt daemon --interval 60 --foreground
# Stop daemon
yt-cm cookies.txt stop
# Check daemon status
yt-cm cookies.txt status
Python API
from yt_cm import YouTubeCookieManager
manager = YouTubeCookieManager("cookies.txt")
# Validate cookie
result = manager.validate()
print(result["valid"]) # True or False
# Renew session
result = manager.renew_session()
print(result["renewed"]) # True or False
print(result["cookie_expiry"]) # Expiration info
# Check auth cookies
result = manager.get_auth_info()
print(result["all_present"]) # All required cookies present
print(result["missing_cookies"]) # List of missing cookies
# Export cookies
content = manager.export_netscape()
Cookie File Format
yt-cm uses the Netscape cookie format exported by browser extensions like "EditThisCookie" or "Cookie Quick Manager".
Example:
# Netscape HTTP Cookie File
.youtube.com TRUE / TRUE 1809975208 SID test_value
.youtube.com TRUE / TRUE 1809975208 __Secure-3PSID test_value
Development
git clone https://github.com/daedalus/yt-cm.git
cd yt-cm
pip install -e ".[test]"
# Run tests
pytest
# Format code
ruff format src/ tests/
# Lint code
ruff check src/ tests/
# Type check
mypy src/
# Install pre-commit hooks
pre-commit install
Architecture
The project follows a layered architecture:
yt_cm.core- Domain logic (YouTubeCookieManager)yt_cm.services- Business logic (CookieDaemon)yt_cm.cli- Command-line interface
Metadata
Release files for yt-cm 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 | |
|---|---|---|---|
| yt_cm-0.1.0.tar.gz | 9.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yt_cm-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.1 kB
Release files / yt_cm-0.1.0.tar.gz
| Download URL | yt_cm-0.1.0.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d13f9cc9e02802d5077dcad6b92c12b0d82d97da11d819dbd8d5e6f9df8e8dd
|
|
BLAKE2b-256 checksum How to use checksums |
5f602aef2f3e714be123fe0e766f91d70661f966849da78b4600a755e89df0ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.
Transparency logRelease files / yt_cm-0.1.0-py3-none-any.whl
| Download URL | yt_cm-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ae1ec64339ad6d4885b5ff8dd7ed319594a9ad960efd2e10a656771807bc07e1
|
|
BLAKE2b-256 checksum How to use checksums |
3dc5405e76c151cab91aa3b481f3561a1b8f7348989e7a02a623ea5eb44556b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.
Transparency log