Skip to main content

YouTube Cookie Manager - Validate and renew YouTube cookies

Project description

yt-cm — YouTube Cookie Manager

PyPI Python Ruff

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yt_cm-0.1.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yt_cm-0.1.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

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

Hashes for yt_cm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5d13f9cc9e02802d5077dcad6b92c12b0d82d97da11d819dbd8d5e6f9df8e8dd
MD5 336f6e9522a4c6d633e1cd73dcee30cd
BLAKE2b-256 5f602aef2f3e714be123fe0e766f91d70661f966849da78b4600a755e89df0ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for yt_cm-0.1.0.tar.gz:

Publisher: pypi-publish.yml on daedalus/yt-cm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for yt_cm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae1ec64339ad6d4885b5ff8dd7ed319594a9ad960efd2e10a656771807bc07e1
MD5 114954f1239fd9a780b80c6388efb387
BLAKE2b-256 3dc5405e76c151cab91aa3b481f3561a1b8f7348989e7a02a623ea5eb44556b2

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page