ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.66k stars 9.97k forks source link

[BUG?] "Unable to extract video data" with fresh install/cookies.txt file #26936

Open tmeitner opened 3 years ago

tmeitner commented 3 years ago

Checklist

Verbose log

mediaserver@mediaserver:~$ youtube-dl --ignore-config --cookies '/mnt/Storage 4/YouTube/cookies.txt' --verbose https://www.youtube.com/watch?v=SBbYlhvV6GY
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--ignore-config', u'--cookies', u'/mnt/Storage 4/YouTube/cookies.txt', u'--verbose', u'https://www.youtube.com/watch?v=SBbYlhvV6GY']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.09.20
[debug] Python version 2.7.18 (CPython) - Linux-5.4.0-51-generic-x86_64-with-Ubuntu-20.04-focal
[debug] exe versions: none
[debug] Proxy map: {}
[youtube] SBbYlhvV6GY: Downloading webpage
ERROR: SBbYlhvV6GY: YouTube said: Unable to extract video data
Traceback (most recent call last):
File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 797, in extract_info
ie_result = ie.extract(url)
File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 532, in extract
ie_result = self._real_extract(url)
File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 1910, in _real_extract
'YouTube said: %s' % unavailable_message, expected=True, video_id=video_id)
ExtractorError: SBbYlhvV6GY: YouTube said: Unable to extract video data

Description

Had to rebuild my home server and set up my YT-DL cron jobs again, noticed they weren't running. Tried running my scripts, was getting "Unable to extract video data" on them. Using latest version. I used the Firefox plugin to grab a fresh cookies file, in case that was the problem. Still the same error.

I'm now running Ubuntu 20.04. I did install ffmpeg per the Reddit auto-bot's suggestion. Same behavior. I attempted to run it with python3.8 and I still get the "unable to extract video data" error.

october262 commented 3 years ago

first try running sudo apt update and sudo apt upgrade to update and upgrade your packages. then try downloading your youtube videos. does it happen on more than one video ?? this link in your log works ok for me - https://www.youtube.com/watch?v=SBbYlhvV6GY

tmeitner commented 3 years ago

first try running sudo apt update and sudo apt upgrade to update and upgrade your packages. then try downloading your youtube videos. does it happen on more than one video ?? this link in your log works ok for me - https://www.youtube.com/watch?v=SBbYlhvV6GY

Thanks for the reply. All packages are updated and upgraded, problem persists.

It happens on all videos from YouTube, not just that one. They all produce the same error. I run a few different scripts with batch commands on them. Here is one, and the YouTube download attempts all throw the same error and don't download:

#!/bin/bash cd '/mnt/Storage 4/Podcasts'; python3.8 /usr/local/bin/youtube-dl --cookies '/mnt/Storage 4/YouTube/cookies.txt' --ignore-config -x --audio-format mp3 --ignore-errors --dateafter now-2weeks --playlist-end 10 --download-archive "/mnt/Storage 4/Podcasts/downloaded.txt" -i -o "%(uploader)s/%(playlist)s/%(title)s.%(ext)s" --add-metadata --batch-file "/mnt/Storage 4/Podcasts/podcasts.txt"

This didn't happen on my previous server, which ran Ubuntu 16.04, I believe (maybe 18.04). Nothing different in the configurations, exact same YTDL commands, but this error keeps coming.

october262 commented 3 years ago

try running youtube-dl --force-generic-extractor https://www.youtube.com/watch?v=SBbYlhvV6GY and see if the video will download.

tmeitner commented 3 years ago

So, it's... working now, I guess?

The --force-generic-extractor command just kicked out an "invalid URL" error on every YouTube link I tried. When I pulled that out and just ran the default youtube-dl command, it worked fine. And then I re-ran my scripts manually, and it appears as though at some point this afternoon, it started working.

The embedding of the thumbnails isn't quite working that reliably, but it looks like my videos are getting downloaded now, even though I've done nothing different. I guess I'll close this one out. Thanks for helping! Weird.

yhtojy commented 3 years ago

26909 more info for this same issue, if we need it one day.

tmeitner commented 3 years ago

Well, back to this error again. Noticed my cron jobs weren't running and here we are. I tried the force-generic-extractor command and every video download just kicks an "Unsupported URL" error.

Here's the full command I'm running. I've been running this for months with zero issues until this new installation. The only thing in the batch file is a list of YouTube URLs.:

/usr/local/bin/youtube-dl --cookies '/mnt/Storage 4/YouTube/cookies.txt' --ignore-config -f best --playlist-reverse --ignore-errors --download-archive "/mnt/Storage 4/YouTube/downloaded.txt" -i -o "%(uploader)s/%(playlist)s/%(uploader)s - S01E%(playlist_index)s - %(title)s.%(ext)s" --add-metadata --write-thumbnail --batch-file="/mnt/Storage 4/YouTube/channel_list.txt"

VADemon commented 3 years ago

"fresh install/cookies file" is not enough, try to delete player cache:

--cache-dir DIR  - Location in the filesystem where youtube-dl can store some downloaded information permanently. By default  $XDG_CACHE_HOME/youtube-dl or  ~/.cache/youtube-dl . At the moment, only YouTube player files (for videos with obfuscated signatures) are cached, but that may change.
--no-cache-dir   Disable filesystem caching
--rm-cache-dir  Delete all filesystem cache files

Further, I just encountered a problem on a single video out of many with just my cookie files, apparently I got targeted with some A/B experiments - this may be true for your account as well. Quite many variables.

davidhalter commented 3 years ago

TL;DR: Fixed it by removing version in ~/.local/. Pip without sudo installs in a different place.

I thought I had the same issue for a while now. I always updated and checked again until I finally started investigating (to check if I was subject to AB testing or something like that). I used a server to check if it works there, which it did. Then I rechecked using a SOCKS proxy. That did not work. I then debugged a bit more and wanted print the players in both locations, which was when I realized that the line numbers/versions did not match.

I finally used youtube-dl --version, which told me that I had an old version still. This version was installed in ~/.local/bin/youtube-dl, which happens when you use python3 -m pip install youtube-dl --upgrade. If you use the same thing with sudo it will tell you you have the latest version, even though you're using another one.

Thanks for a great project!