Maxstupo / ydl-ui

A UI for the command-line video downloader "youtube-dl"
MIT License
352 stars 34 forks source link

Restricted YouTube videos cannot be downloaded / Login fails #107

Closed Nevetos closed 2 years ago

Nevetos commented 2 years ago

Any youtube restricted content which needs logging in will not download. (Or login fails?)

Log entry:

Working Directory: C:\Users\******\Videos
YDL Version: 2.9.0

Executing: C:\Program Files\YDL-UI_v2.9.0.0_Portable\bin\youtube-dl.exe --ignore-errors --ignore-config --no-overwrites --no-cache-dir --write-thumbnail --format "bestvideo[height=?1080][fps=?30]+bestaudio/bestvideo[height=?1080][fps=?25]+bestaudio/bestvideo[height=?1080][fps=?24]+bestaudio/bestvideo[height=?720][fps=?30]+bestaudio/bestvideo[height=?720][fps=?25]+bestaudio/bestvideo[height=?720][fps=?24]+bestaudio/bestvideo[height=?480][fps=?30]+bestaudio/bestvideo[height=?480][fps=?25]+bestaudio/bestvideo[height=?480][fps=?24]+bestaudio/bestvideo[height=?360][fps=?30]+bestaudio/bestvideo[height=?360][fps=?25]+bestaudio/bestvideo[height=?360][fps=?24]+bestaudio/bestvideo[height=?240][fps=?30]+bestaudio/bestvideo[height=?240][fps=?25]+bestaudio/bestvideo[height=?240][fps=?24]+bestaudio/bestvideo[height=?144][fps=?30]+bestaudio/bestvideo[height=?144][fps=?25]+bestaudio/bestvideo[height=?144][fps=?24]+bestaudio/bestvideo[height<=?1080][fps<=?30]+bestaudio/best" --username "AUsernameWasHere" --password "APasswordWasHere" --prefer-ffmpeg --ffmpeg-location "C:\Program Files\YDL-UI_v2.9.0.0_Portable\bin\ffmpeg\ffmpeg.exe"  "https://www.youtube.com/watch?v=d1TnAnqOpzA&ab_channel=Police%D0%A1hase"

[youtube] Downloading login page
[youtube] Looking up account info
WARNING: Unable to look up account info: HTTP Error 400: Bad Request
[youtube] d1TnAnqOpzA: Downloading webpage
[youtube] d1TnAnqOpzA: Refetching age-gated info webpage
WARNING: unable to download video info webpage: HTTP Error 410: Gone
ERROR: Sign in to confirm your age
This video may be inappropriate for some users.
Nevetos commented 2 years ago

And I have found a solution. It was already possible, just not explained well.

For anyone wanting to know:

  1. Get the chrome extension https://chrome.google.com/webstore/detail/get-cookiestxt/bgaddhkoddajcdgocldbbfleckgcbcid?hl=en
  2. Go to https://www.youtube.com/ & login with your account. Grab the cookie txt file.
  3. Go to https://myaccount.google.com/ & login with your account. Grab the cookie txt file.
  4. Combine both into a txt, making sure to have the following at the top of the txt file (Without the ` ):
`# Netscape HTTP Cookie File
`# This file is generated by youtube-dl.  Do not edit.
  1. In YDL-UI when you want to download a new video: a) Un-select basic mode b) Go to 'Workarounds' tab c) Tick 'Cookies:' and link to the cookies file. d) Tick 'Username' under 'Authentication' and put in login details.
Maxstupo commented 2 years ago

That is the main solution that I know of. I don't think you need to include step 3 or add your login details. Just the cookies from YouTube should be enough.