Ubuntu – ERROR: Unable to extract info section when downloading YouTube videos with youtube-dl

downloadsvideoyoutube

IMHO I don't think this question is a duplicate of that one due these reasons:

  1. Let's begin by considering the titles: How can I update youtube-dl?, clearly focuses on a single application/update procedure instead a report of a download failure not focused on only one application.
  2. Tags: This question: video, downloads, youtube. The other: apt, updates, youtube. They only have the youtube tag in common.
  3. The two questions have overlapping topics, but they are not identical questions because the other question's topic is a subset of the topic of this one.

Now let's see more arguments (in parentheses):


I'm trying to download some YouTube videos first by Firefox + Video DownloadHelper, then by VLC and finally by youtube-dl program and there's something that is blocking them.

(The other:"I use youtube-dl to download videos for watching later offline", again this question focuses on download blocking in YouTube regardless of the application and the other, in a single application (youtube-dl) )

On the description screens I don't see any restriction about download.

(This is not mentioned in the other question.)

An example: I'm trying to download 2 videos with same category/license, the first works fine and the second returns an exception:

luis@jupiter:~$ youtube-dl "https://www.youtube.com/watch?v=wo6Sq1h2DI4"
[youtube] wo6Sq1h2DI4: Downloading webpage
[youtube] wo6Sq1h2DI4: Downloading video info webpage
[youtube] wo6Sq1h2DI4: Extracting video information
[youtube] wo6Sq1h2DI4: Downloading MPD manifest
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[download] Destination: SÂNSCRITO - Aula 6 (Consoantes Mudas Dentais) com Jonas Masetti-wo6Sq1h2DI4.f137.mp4
[download] 100% of 142.54MiB in 04:11
[download] Destination: SÂNSCRITO - Aula 6 (Consoantes Mudas Dentais) com Jonas Masetti-wo6Sq1h2DI4.f251.webm
[download] 100% of 8.75MiB in 00:16
[ffmpeg] Merging formats into "SÂNSCRITO - Aula 6 (Consoantes Mudas Dentais) com Jonas Masetti-wo6Sq1h2DI4.mkv"
Deleting original file SÂNSCRITO - Aula 6 (Consoantes Mudas Dentais) com Jonas Masetti-wo6Sq1h2DI4.f137.mp4 (pass -k to keep)
Deleting original file SÂNSCRITO - Aula 6 (Consoantes Mudas Dentais) com Jonas Masetti-wo6Sq1h2DI4.f251.webm (pass -k to keep)
luis@jupiter:~$ youtube-dl "https://www.youtube.com/watch?v=BbbhZl8xqVY"
[youtube] BbbhZl8xqVY: Downloading webpage
[youtube] BbbhZl8xqVY: Downloading video info webpage
[youtube] BbbhZl8xqVY: Extracting video information
[youtube] BbbhZl8xqVY: Downloading js player en_US-vflHuW2fm
ERROR: Signature extraction failed: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 905, in _decrypt_signature
    video_id, player_url, s
  File "/usr/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 820, in _extract_signature_function
    res = self._parse_sig_js(code)
  File "/usr/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 883, in _parse_sig_js
    initial_function = jsi.extract_function(funcname)
  File "/usr/lib/python2.7/dist-packages/youtube_dl/jsinterp.py", line 241, in extract_function
    raise ExtractorError('Could not find JS function %r' % funcname)
ExtractorError: Could not find JS function u'Ny'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
 (caused by ExtractorError(u"Could not find JS function u'Ny'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.",)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Is it a YouTube restriction, a video encoding issue or an Ubuntu signature problem? If this is a YouTube restriction, is this a restriction for all YouTube videos or does the restriction operate selectively, for example for newly uploaded videos, but not for videos that were uploaded years ago?

The output of the other question:

ERROR: Unable to extract info section; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type youtube-dl -U to update.

(The output's a little bit different, isn't it?)


Finally there are two more issues to be considered:

  • Although the upgrade of youtube-dl has helped me to solve my problem, it didn't answer this item of my question: I'm trying to download 2 videos with same category/license, the first works fine and the second returns an exception.
  • The other question was written in 2013, and I believe that since then some things have changed in YouTube service and applications' way of accessing it.

Best Answer

  • The first video downloaded successfully with a recently updated version of youtube-dl which I installed with python-pip using python pip install youtube-dl inside a Python virtual environment (python-virtualenv). For information about how to setup and use a Python virtual environment see How to set up and use a virtual python environment in Ubuntu?.

    The command I used to show the available video formats was:

    youtube-dl -F "https://www.youtube.com/watch?v=wo6Sq1h2DI4"
    

    The command I used to download the first YouTube video was:

    youtube-dl -f 18 "https://www.youtube.com/watch?v=wo6Sq1h2DI4"
    

    The second video could not be downloaded using youtube-dl, but I did not give up. I upgraded my youtube-dl to the latest version by running:

    pip install --upgrade youtube-dl  # inside the Python virtual environment
    

    I didn't need to use sudo because my Python virtual environment was installed inside my own user directory (~/my-Python-virtual-env). After upgrading youtube-dl I ran this command to download the second YouTube video:

    youtube-dl -f 18 "https://www.youtube.com/watch?v=BbbhZl8xqVY"
    

    Why not simply use sudo pip install --upgrade youtube-dl ?

    One of the reasons I use Ubuntu is to escape the madness of the way Windows installs applications. I install packages from the default Ubuntu repositories whenever possible. In this case I know that youtube-dl is a Python program, so I can locally install the latest version of youtube-dl in a Python virtual environment without messing up my filesystem.

    Another alternative is to install the youtube-dl snap package:

    sudo snap install youtube-dl # start with snap run youtube-dl 
    

    I believe that since from now some things have changed in YouTube's service and applications' way to access it.

    True. Google has been changing the way to access YouTube videos more frequently now than was the case three years ago, so in order to keep youtube-dl up-to-date, it has to be updated more frequently too. I have observed over the years that YouTube videos appear to be blocked mostly related to the date when they were uploaded.

    Before I started using youtube-dl, I used a Firefox extension called Video DownloadHelper to download YouTube videos. I have come to prefer youtube-dl because it has the highest probability of successfully grabbing YouTube videos of any downloader that I have ever used.