You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

gxx

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gxx

fetch youtube cookies from remote api to use with yt_dlp .

2.7.7
pipPyPI
Maintainers
1

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 .

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts