Skip to content

Instantly share code, notes, and snippets.

@sathishshan
Last active June 22, 2026 14:15
Show Gist options
  • Select an option

  • Save sathishshan/79b850c8cb14190c37d199a564611bd6 to your computer and use it in GitHub Desktop.

Select an option

Save sathishshan/79b850c8cb14190c37d199a564611bd6 to your computer and use it in GitHub Desktop.
Download youtube private or member videos
#single video
youtube-dl --cookies youtube.com_cookies.txt "URL"
#playlist
youtube-dl --yes-playlist --cookies youtube.com_cookies.txt "URL"
You can use: --playlist-start, --playlist-end, --playlist-reverse or --playlist-items to achieve this goal.
#Note: cookie should be in Netscape format
Addons
#https://chrome.google.com/webstore/detail/get-cookiestxt/bgaddhkoddajcdgocldbbfleckgcbcid
#https://addons.mozilla.org/en-US/firefox/addon/cookies-txt/
python.exe -m pip install --upgrade pip
pip install yt-dlp
yt-dlp --yes-playlist --playlist-start 16 --cookies cookies.txt "https://www.youtube.com/playlist?"
curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -
-------------
Youtube-dl multiple videos download from a file.
yt-dlp.exe -a file.txt
-------------
Subtitile & Video Resolution:
yt-dlp --list-subs --cookies youtube_cookie.txt URL
yt-dlp --write-auto-sub --sub-format srt --sub-lang en --skip-download --cookies youtube_cookie.txt URL
To select the video quality, first use the -F option to list the available formats, here’s an example,
youtube-dl -F URL
The best quality is 22 so use -f 22 instead of -F to download the MP4 video with 1280x720 resolution like this:
youtube-dl -f 22 URL
@progaming15

Copy link
Copy Markdown

@dev-vaibhav-0

Copy link
Copy Markdown

@4rtb yes u can do it bro its so easy like bro

@dev-vaibhav-0

Copy link
Copy Markdown

just use IDM

@theLucidLibrarian

Copy link
Copy Markdown

just use IDM

What's that?

@adiothers1234-coder

Copy link
Copy Markdown

Guys I have a membership but its still says to Join the membership. If it doesn't work then is there any way to download the membership video, and if yes then please try to explain in detail. please

@naufalist

Copy link
Copy Markdown

Guys I have a membership but its still says to Join the membership. If it doesn't work then is there any way to download the membership video, and if yes then please try to explain in detail. please

I think you have a problem with your cookies. Make sure you did it the right way when exporting and attaching the cookies file.

@stoper223

Copy link
Copy Markdown

my youtuber daily upload video , it once set i up by paying member ship can i get video for free for every . it will work only i having member ship .

@adiothers1234-coder

Copy link
Copy Markdown

Guys I have a membership but its still says to Join the membership. If it doesn't work then is there any way to download the membership video, and if yes then please try to explain in detail. please

I think you have a problem with your cookies. Make sure you did it the right way when exporting and attaching the cookies file.

Do you have any good way to export and attach the cookie?

@naufalist

naufalist commented May 6, 2026

Copy link
Copy Markdown

I think you have a problem with your cookies. Make sure you did it the right way when exporting and attaching the cookies file.

Do you have any good way to export and attach the cookie?

I used this extension to export cookie (from chrome browser): https://chromewebstore.google.com/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc

To attach the cookie file, pass this argument: --cookies cookies.txt

Just make sure the cookie file is in netscape format.
image

@adiothers1234-coder

Copy link
Copy Markdown

I think you have a problem with your cookies. Make sure you did it the right way when exporting and attaching the cookies file.

Do you have any good way to export and attach the cookie?

I used this extension to export cookie (from chrome browser): https://chromewebstore.google.com/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc

To attach the cookie file, pass this argument: --cookies cookies.txt

Just make sure the cookie file is in netscape format. image

Its still showing the same error.
Screenshot 2026-05-07 183803

@naufalist

Copy link
Copy Markdown

Its still showing the same error. Screenshot 2026-05-07 183803

Ah, I think I get the issue.
It's about your membership level. Some youtubers use tiers, so you have to reach a certain level to unlock some videos.
That means you might need to stay a member for a few months or even a year to access them.

@adiothers1234-coder

Copy link
Copy Markdown

Its still showing the same error. Screenshot 2026-05-07 183803

Ah, I think I get the issue. It's about your membership level. Some youtubers use tiers, so you have to reach a certain level to unlock some videos. That means you might need to stay a member for a few months or even a year to access them.

But I am on the top-most level. Or is there any other way I can download these videos?

@naufalist

Copy link
Copy Markdown

Ah, I think I get the issue. It's about your membership level. Some youtubers use tiers, so you have to reach a certain level to unlock some videos. That means you might need to stay a member for a few months or even a year to access them.

But I am on the top-most level. Or is there any other way I can download these videos?

I'm just making an assumption here since I don't know the exact cause yet. If you have multiple youtube accounts signed into chrome, could you try making sure only one account is signed in? That way, the exported cookies will definitely match the intended account. I'm assuming the issue might be caused by the cookies being taken from the wrong account.

Also, have you tried playing the video manually in the browser? Can the video be played normally there?

I just tested downloading a members-only video myself, and it still works fine. So this doesn't seem to be an issue with yt-dlp itself. As long as you attach cookies from an account that already has the required membership level for the target video, the video should be downloadable.

image

@adiothers1234-coder

Copy link
Copy Markdown

Ah, I think I get the issue. It's about your membership level. Some youtubers use tiers, so you have to reach a certain level to unlock some videos. That means you might need to stay a member for a few months or even a year to access them.

But I am on the top-most level. Or is there any other way I can download these videos?

I'm just making an assumption here since I don't know the exact cause yet. If you have multiple youtube accounts signed into chrome, could you try making sure only one account is signed in? That way, the exported cookies will definitely match the intended account. I'm assuming the issue might be caused by the cookies being taken from the wrong account.

Also, have you tried playing the video manually in the browser? Can the video be played normally there?

I just tested downloading a members-only video myself, and it still works fine. So this doesn't seem to be an issue with yt-dlp itself. As long as you attach cookies from an account that already has the required membership level for the target video, the video should be downloadable.

image

I tried the ways you told nut its not working. Is there any other way like a website or a application through which I can download the videos?

@naufalist

Copy link
Copy Markdown

I tried the ways you told nut its not working. Is there any other way like a website or a application through which I can download the videos?

Unfortunately, no matter what website or app you try, none of them will be able to download that video unless they already have authorized membership access to it.

@adiothers1234-coder

Copy link
Copy Markdown

I tried the ways you told nut its not working. Is there any other way like a website or a application through which I can download the videos?

Unfortunately, no matter what website or app you try, none of them will be able to download that video unless they already have authorized membership access to it.

That's what I am telling you I am a member to the channel. Can it be due to the duration of the membership? Because I bought it for the very first time.

@naufalist

Copy link
Copy Markdown

That's what I am telling you I am a member to the channel. Can it be due to the duration of the membership? Because I bought it for the very first time.

I'm pretty sure the issue is with your membership. Maybe double-check your membership status, and if needed, try paying again to upgrade your tier or extend your membership. It might help.

@ddsgenerator-rgb

Copy link
Copy Markdown

@ArleNadja2424

Copy link
Copy Markdown

Hi, I was just wondering how you use this? It came up when I was trying to find out a way to download a private YouTube video but I don't understand what any of it means :(

@omar11sabounji-ctrl

Copy link
Copy Markdown
<script src="https://gist.github.com/sathishshan/79b850c8cb14190c37d199a564611bd6.js"></script>

@omar11sabounji-ctrl

Copy link
Copy Markdown

@bloodzyne

Copy link
Copy Markdown

I think you have a problem with your cookies. Make sure you did it the right way when exporting and attaching the cookies file.

Do you have any good way to export and attach the cookie?

I used this extension to export cookie (from chrome browser): https://chromewebstore.google.com/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc
To attach the cookie file, pass this argument: --cookies cookies.txt
Just make sure the cookie file is in netscape format. image

Its still showing the same error. Screenshot 2026-05-07 183803

hey i had the same problem but if you have an adblocker on youtube it probably gets in the way when exporting cookies because after i turned it off the command worked! hope this helps.

@effortless-guy

Copy link
Copy Markdown

How to download Membership only videos?

This guide documents the setup process that worked for me on Windows. It assumes you already have legitimate access to the videos through your own account.

Important: Respect copyright laws and platform terms. Only access content you are authorized to view.

Prerequisites

  • Windows 10 or Windows 11
  • Google Chrome
  • YouTube account with access to the videos
  • Administrator rights to install software

Step 1 - Prepare Google Chrome

  1. Install Google Chrome if not already installed.
  2. Set Chrome as your default browser.
  3. Sign into Chrome using the same Google account that has access to the videos.
  4. Open YouTube and verify you can watch the videos normally.

Step 2 - Install Python

  1. Download Python from https://www.python.org/downloads/
  2. During installation check Add Python to PATH.
  3. Finish installation.

Verify:

python --version

You should see something similar to:

Python 3.12.x

Step 3 - Install Node.js

  1. Download Node.js LTS from https://nodejs.org
  2. Install using default options.

Verify:

node --version
npm.cmd --version

Step 4 - Install Deno

Some environments may use Deno when working with yt-dlp JavaScript challenge solving.

Install:

irm https://deno.land/install.ps1 | iex

Verify:

deno --version

Step 5 - Install FFmpeg

Install:

winget install Gyan.FFmpeg
After installing FFmpeg, completely close PowerShell / CMD and open a new terminal window. Otherwise ffmpeg may not be detected because PATH has not refreshed yet.

Verify:

ffmpeg -version

Step 6 - Install yt-dlp

python -m pip install -U yt-dlp

Verify:

python -m yt_dlp --version

Step 7 - Install yt-dlp-ejs

python -m pip install -U yt-dlp-ejs

Step 8 - Verify Everything

python --version
node --version
npm.cmd --version
deno --version
ffmpeg -version
python -m yt_dlp --version

All commands should display version information without errors.

Step 9 - Export Cookies

Install the following Chrome extension:

  • Get cookies.txt Locally

Chrome Web Store:
https://chromewebstore.google.com/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc

GitHub Project:
https://github.com/kairi003/Get-cookies.txt-Locally

  1. Open YouTube in Chrome.
  2. Make sure you are logged in.
  3. Click the extension icon.
  4. Export cookies in Netscape format.
  5. Save the file as cookies.txt.

Step 10 - Download Videos

Replace VIDEO_URL with the actual URL.

python -m yt_dlp --cookies cookies.txt --remote-components ejs:npm -f "bv*+ba/b" --merge-output-format mp4 "Video/PlayList Link"

If you have already donnwloaded 80 video oit of 120 in a p playlios then yiu can start from 81st vdieo with this command

python -m yt_dlp --playlist-start 81 --cookies cookies.txt --remote-components ejs:npm -f "bv*+ba/b" --merge-output-format mp4 "URL"

This shows download the best available format of video and confirms your setup is working.

Optional - Download Videos to a Specific Folder

By default, videos will be downloaded to the current folder where you run the command.

You can create a dedicated folder for your downloads:

mkdir MyVideos
cd MyVideos

You can still reference cookies.txt from another location using a relative path:

python -m yt_dlp --cookies ..\cookies.txt --remote-components ejs:npm -f "bv*+ba/b" --merge-output-format mp4 "VIDEO_URL"

Example folder structure:

Downloads
├── cookies.txt
└── MyVideos

In this example, cookies.txt stays in Downloads while all downloaded videos are stored inside MyVideos.

Frequently Asked Questions (FAQ)

Q: ffmpeg is installed but Windows says 'ffmpeg is not recognized'?

A: Close all PowerShell/CMD windows and open a brand new terminal. FFmpeg updates the PATH variable during installation and existing terminals will not see the change.

Q: npm gives an Execution Policy error?

A: Use:

npm.cmd --version

instead of:

npm --version

Q: The command only shows image formats?

A: Usually one of the following:

  • cookies.txt is invalid or expired
  • You are not logged into the correct YouTube account
  • yt-dlp-ejs is not installed
  • Node.js installation is missing or broken

Q: Do I need Deno?

A: Not always. In my testing, the ejs:npm solution using Node.js worked reliably. Deno is included because some setups may use it.

Q: Can I download an entire playlist?

A: Yes.

python -m yt_dlp --cookies cookies.txt --remote-components ejs:npm -f "bv*+ba/b" --merge-output-format mp4 "PLAYLIST_URL"

Q: Can I resume from a specific playlist video?

A: Yes.

python -m yt_dlp --playlist-start 81 --cookies cookies.txt --remote-components ejs:npm -f "bv*+ba/b" --merge-output-format mp4 "PLAYLIST_URL"

Q: How do I download only a few videos from a playlist?

python -m yt_dlp --playlist-items 10-20 --cookies cookies.txt --remote-components ejs:npm -f "bv*+ba/b" --merge-output-format mp4 "PLAYLIST_URL"

Q: My cookies stopped working after a few weeks?

A: Export a fresh cookies.txt file using the browser extension and replace the old one.

Q: Can I keep the downloaded videos forever?

A: Downloaded files stay on your computer until you delete them. Make sure you have enough disk space because large playlists can consume many gigabytes.

Q: How much space do I need?

A: 1080p videos are often hundreds of megabytes each. Large playlists may require tens of gigabytes of free storage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment