YouTube Cookie Manager - Validate and renew YouTube cookies
Project description
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
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 yt_cm-0.1.0.tar.gz.
File metadata
- Download URL: yt_cm-0.1.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d13f9cc9e02802d5077dcad6b92c12b0d82d97da11d819dbd8d5e6f9df8e8dd
|
|
| MD5 |
336f6e9522a4c6d633e1cd73dcee30cd
|
|
| BLAKE2b-256 |
5f602aef2f3e714be123fe0e766f91d70661f966849da78b4600a755e89df0ab
|
Provenance
The following attestation bundles were made for yt_cm-0.1.0.tar.gz:
Publisher:
pypi-publish.yml on daedalus/yt-cm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yt_cm-0.1.0.tar.gz -
Subject digest:
5d13f9cc9e02802d5077dcad6b92c12b0d82d97da11d819dbd8d5e6f9df8e8dd - Sigstore transparency entry: 1314011678
- Sigstore integration time:
-
Permalink:
daedalus/yt-cm@8ade2ed133e1dd6c2d02020639ea82b1e4e76d3b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/daedalus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@8ade2ed133e1dd6c2d02020639ea82b1e4e76d3b -
Trigger Event:
release
-
Statement type:
File details
Details for the file yt_cm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: yt_cm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae1ec64339ad6d4885b5ff8dd7ed319594a9ad960efd2e10a656771807bc07e1
|
|
| MD5 |
114954f1239fd9a780b80c6388efb387
|
|
| BLAKE2b-256 |
3dc5405e76c151cab91aa3b481f3561a1b8f7348989e7a02a623ea5eb44556b2
|
Provenance
The following attestation bundles were made for yt_cm-0.1.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on daedalus/yt-cm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yt_cm-0.1.0-py3-none-any.whl -
Subject digest:
ae1ec64339ad6d4885b5ff8dd7ed319594a9ad960efd2e10a656771807bc07e1 - Sigstore transparency entry: 1314012037
- Sigstore integration time:
-
Permalink:
daedalus/yt-cm@8ade2ed133e1dd6c2d02020639ea82b1e4e76d3b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/daedalus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@8ade2ed133e1dd6c2d02020639ea82b1e4e76d3b -
Trigger Event:
release
-
Statement type: