4

I recently attempted to download a YouTube video using youtube-dl and it printed the following error:

[youtube] 8_Ik8elX96w: Downloading webpage
[youtube] 8_Ik8elX96w: Downloading embed webpage
[youtube] 8_Ik8elX96w: Refetching age-gated info webpage
ERROR: This video may be inappropriate for some users.

This is the url of the YouTube video I tried to download:

https://www.youtube.com/watch?v=8_Ik8elX96w

There is nothing inappropriate about the video. I'd like to know if there is a work-around for whatever is causing this.

Allan
  • 593
  • 4
    It is an age-restricted video, so you must sign in before you can access it. youtube-dl cannot handle these requests I believe. (the uploader of the video has put the age-limits on the video; youtube handles it via sign-in) – guiverc Jun 02 '21 at 11:08
  • 5
    You need the --cookies (and a path to a cookie) option See for instance this video https://www.youtube.com/watch?v=XgnwCQzjau8 "Ubuntu is detecting these flags and enforcing them on Ubuntu users" Sorry?! Ubuntu does nothing here. It is youtube. – Rinzwind Jun 02 '21 at 11:10
  • @guiverc I was signed in to YouTube/Google when I tried downloading it. – Allan Jun 02 '21 at 11:18
  • 3
    youtube-dl doesn't download via your browser; it goes to youtube directly; so you need to sign in via youtube-dl which is something it currently can't handle (or couldn't last time I tried to use it, which was awhile ago & looked through the docs/code etc) Refer to @Rinzwind's comment... it maybe possible (it's been >12 months since I last tried; maybe longer & it'll have changed) – guiverc Jun 02 '21 at 11:19
  • @alan then you need to find the cookie set and supply it through command line. – Rinzwind Jun 02 '21 at 12:02
  • @Rinzwind That video is hard to follow. I don't know what that browser icon he clicked on is, or its equivalent in Firefox, which is what I'm using. Also, he's working in Windows and I'm using Ubuntu. I can't follow anything he says after that. – Allan Jun 02 '21 at 12:36
  • @karel They are not the same error messages I am getting. – Allan Jul 26 '21 at 12:14

6 Answers6

3

Looks like youtube-dl doesn't support the latest Youtube changes in age restrictions. However, there are multiple websites that allow you to view and download such videos without logging in. Instead of youtube.com?watch=id go to for example youtubensfw.com?watch=id (you can download simply by right-clicking on the video), genyoutube.com?watch=id or ssyoutube.com?watch=id (with these two, download links are directly on the page). There are lots more of such sites. Myself I don't see the need to use youtube-dl at all when sites like this are available.

Update: currently the only way to view age-restricted videos seems to be via using the Invidious network. All other methods seem to not work anymore. The main server of the Invidious network can be accessed by replacing youtube.com by yewtu.be in the video URL. You can also use the FreeTube application, that can use Invidious servers internally. After installation, the application adds support for freetube:// type links - if you prefix the entire Youtube video link with freetube://, it will open in the application.

raj
  • 10,353
  • NSFW didn't download the video. It says "No video with supported format and MIME type found." and "YouTube has changed some codes in their back-end. Your videos might not work here. We will fix it soon. Don’t worry!!!" The "gen" site has pop-up ads to porn sites and clicking on "Generate Download Link" is actually a link to a porn ad. The "ss" site says "Download link not found" when I click on "Download". – Allan Jul 25 '21 at 08:40
  • @Allan Use an ad blocker, I wonder why anyone would use a web browser without an ad blocker? With an ad blocker, I don't see any ads on the mentioned sites. – raj Jul 25 '21 at 09:18
  • I never needed an ad blocker because most websites don't have porn ads. The genyoutube site didn't just have porn ads, it sent me to a porn page when I clicked on the "Generate Download Link" for downloading the YT video. The other two sites you mentioned don't have porn ads but they also didn't download the videos, so something seems wrong with those sites as well. – Allan Jul 25 '21 at 10:09
  • I tried all the links you mentioned above. None of them worked. – Arne Feb 15 '22 at 12:21
  • @Arne Referring to your original video, this link works: https://invidious.privacy.gd/watch?v=8_Ik8elX96w . Some videos may be geoblocked, so it's always worth to try a different Invidious instance, located in another country. – raj Feb 15 '22 at 12:56
  • @raj the video I wanted to download has been taken down by now. I couldn't download it. So I would say, by now it is too late. – Arne Feb 16 '22 at 15:10
  • @Arne So I understand it was a different video than the one you mentioned, 8_Ik8elX96w ? Because I can still view and download this one under the link I posted. – raj Feb 16 '22 at 15:44
2

The policy issue is with YouTube, rather than with Ubuntu or the YouTube downloader. To answer the technical part of the question:

youtube-dl -u 'youtube-username' -p 'youtube-password' https://www.youtube.com/watch?v=hicC53AhZ6Y

Ensure you are running the latest version.

Not ideal but it works.

  • 2
    I tried using that line and got the response: [youtube] Downloading login page [youtube] Looking up account info WARNING: Unable to look up account info: HTTP Error 400: Bad Request (Followed by the same lines that I quoted in my question above.) – Allan Jun 10 '21 at 13:07
  • 1
    @Allan paste the exact command you used, and the version of the downloader you are using. Obviously obfuscate your own YouTube username and password. – Wade John Beckett Jun 10 '21 at 19:00
  • Here it is: youtube-dl -u username -p password https://www.youtube.com/watch?v=8_Ik8elX96w I also tried it with the single quotes you used, since I wasn't sure they are supposed to be in the actual command: youtube-dl -u 'username' -p 'password' https://www.youtube.com/watch?v=8_Ik8elX96w – Allan Jun 12 '21 at 06:56
  • Sorry - I didn't include the version of the downloader. It's youtube-dl, terminal version, version 2021.01.16 – Allan Jun 13 '21 at 08:01
  • @Allan try to upgrade to the latest version 2021.06.06 at the time of this writing. – Wade John Beckett Jun 14 '21 at 11:21
  • No, it does not work, looks like it never really did for long. – Markus Bawidamann Dec 28 '21 at 09:39
2

youtube-dl -u 'YoutubeLOGIN' -p 'App password' --cookie "youtube.com_cookies.txt" 'YOUTUBE URL LINK'


I used the plugin for chrome called Get cookies.txt and exported the txt file and since i had first age restrictions and after that HTTP errors not using both cookie and login i used both now and app password. Worked with VPN + WebRTC Blocking + HTML5 Geo blocking etc (Not sure if that matters but im a rookie when it comes to this.

First cookie file did not work at all and for some reason my command line was like this when it worked, with 2 factor login enabled.I was logged in having the video right in front me of me if that matters idk.

I didnt use 'or " other than for cookie, and mock me, i don't know why and when to use really but i learned rather use it than not. I opened the PowerShell from the folder i just extracted/downloaded the cookie txt file from and used with help from the thread creator something that worked, thanks. I'm close to buying something like 4k downloader, but it's a fight against the system we take here, ain't paying. Im happy i got the 60 fps vp9 version been trying so long. My video was blocked worldwide, private etc.

thanks community, i still don't know what im doing im copying a bit from everybody until a problem is fixed. so again if someone thinks "hes stupid" you are right i figured there must be more people like me struggling so if i can help i try.

Sherlockholmesguessing here but the age restriction is the main problem not the cookie if i have to guess.

youtube-dl -u EMAIL -p APPPASSWORD --cookie "youtube.com_cookies.txt" YOUTUBE-URL

1

For those still unable to make it work, despite using the file retrieved from the "Get cookies.txt" extension, because of the AttributeError: 'bool' object has no attribute 'split' error you can also try using Python 3.x with the following command (I've added the --verbose flag in case of debugging):

python3 /usr/local/bin/youtube-dl -f bestvideo+bestaudio \
    --all-subs --cookies $PWD/youtube.com_cookies.txt \
    "https://www.youtube.com/watch?v=VIDEO_ID_HERE" --verbose

Make sure to do the following first:

  • Ensure the python3 command is working and actually runs a version of Python 3.x.
  • Make sure that the path to your cookies file is correct.
  • Make sure that you have the latest version of youtube-dl installed (youtube-dl --version).
  • Ensure the absolute file path for the youtube-dl binary or installation (In a UNIX-like terminal use which youtube-dl).
Benji A.
  • 53
  • 1
  • 6
1

a ubuntu expert I chatted to mentioned yt-dlp one to me..

yt-dlp is faster and more updated than youtube-dl, also I tested it on your video and on another age restricted video, and it works, while youtube-dl(if merely doing youtube-dl url) doesn't.

user@system:~/# yt-dlp https://www.youtube.com/watch?v=8_Ik8elX96w 1>a.a 2>&1

user@system:~/# cat a.a [youtube] 8_Ik8elX96w: Downloading webpage [youtube] 8_Ik8elX96w: Downloading android player API JSON [youtube] 8_Ik8elX96w: Downloading tv embedded player API JSON [youtube] 8_Ik8elX96w: Downloading web embedded client config [youtube] 8_Ik8elX96w: Downloading player c403842a [youtube] 8_Ik8elX96w: Downloading web embedded player API JSON [info] 8_Ik8elX96w: Downloading 1 format(s): 22 [download] Resuming download at byte 20969472 [download] Destination: Anarchy, U.S.A. – In the Name of Civil Rights [8_Ik8elX96w].mp4 [download] 22.1% of 906.25MiB at 11.92MiB/s ETA 00:59 ERROR: Interrupted by user user@system:~/#

and to delete the partially downloaded file.

user@system:~/# rm "Anarchy, U.S.A. – In the Name of Civil Rights [8_Ik8elX96w].mp4.part"

You could have chosen a better example by the way. This video is also age restricted but is at least a smaller video about 120MB https://www.youtube.com/watch?v=xeZ3k2ywQ6Y as opposed to your almost 1GB file.

Note- as of Jan 2024 (and quite a bit before then), neither of them work..in my tests. Youtube has tightened down. https://www.ytbvideoly.com/ is a site that seems fine. If the website says it's blocked then you can use a VPN, though they tend to be paid, like surfshark vpn, and that has a VPN browser extension.

barlop
  • 125
  • 1
  • 9
  • I tried to download an age-restricted video and got the error: "ERROR: [youtube] 8_Ik8elX96w: Sign in to confirm your age. This video may be inappropriate for some users." – Paul Jones Jun 11 '22 at 19:53
  • @PaulJones maybe you used youtube-dl but I said to use yt-dlp. See my answer, I downloaded your "anarchy" video(which is the same one and same link mentioned by the OP), with the command I said does it, yt-dlp, not youtube-dl . What I did was done from a windows machine but it'd apply to ubuntu too – barlop Jun 15 '22 at 03:20
0

The solution is to pass a cookie to YouTube as part of the download process in YouTube-DL. I was able to accomplish that with the following steps.

  1. I installed the Get Cookies extension in Chrome. This extension allows users to export cookies for a site as a text file. (At this point I had to restart Chrome to make the Get Cookies extension work)

  2. I then visited YouTube.com, and while I was logged in, I right-clicked the page and clicked "Get cookies.txt"

  3. This created a youtube.com_cookies.txt file in my Downloads folder

  4. Finally I ran the following command in the Terminal to download the video:

    youtube-dl -f bestvideo+bestaudio --merge-output-format mkv --all-subs --cookies "/home/[Home folder name]/Downloads/youtube_com.txt" [YouTube URL]