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
130.47k stars 9.85k forks source link

Unable to download some nicovideo.jp videos #3753

Closed ariasuni closed 9 years ago

ariasuni commented 9 years ago

Here it is:

$ youtube-dl --verbose http://www.nicovideo.jp/watch/sm18468312
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['--verbose', 'http://www.nicovideo.jp/watch/sm18468312']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2014.09.14.3
[debug] Python version 3.4.1 - Linux-3.16.2-1-ARCH-x86_64-with-arch
[debug] Proxy map: {}
[niconico] sm18468312: Downloading webpage
[niconico] sm18468312: Downloading video info page
[niconico] sm18468312: Downloading webpage
ERROR: Unable to extract thumbPlayKey; 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.
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/youtube_dl/YoutubeDL.py", line 523, in extract_info
    ie_result = ie.extract(url)
  File "/usr/lib/python3.4/site-packages/youtube_dl/extractor/common.py", line 178, in extract
    return self._real_extract(url)
  File "/usr/lib/python3.4/site-packages/youtube_dl/extractor/niconico.py", line 95, in _real_extract
    r'\'thumbPlayKey\'\s*:\s*\'(.*?)\'', ext_player_info, 'thumbPlayKey')
  File "/usr/lib/python3.4/site-packages/youtube_dl/extractor/common.py", line 399, in _search_regex
    raise RegexNotFoundError('Unable to extract %s' % _name)
youtube_dl.utils.RegexNotFoundError: Unable to extract thumbPlayKey; 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.
naglis commented 9 years ago

I can reproduce it, however, I don't have a fix. As a workaround, I've found that it does work if you provide valid login information.

ariasuni commented 9 years ago

How am I supposed to provide login information to youtube-dl?

dstftw commented 9 years ago

youtube-dl -u username -p password http://www.nicovideo.jp/watch/sm18468312 Alternatively, you can use .netrc in order not to pass it all the time.

ariasuni commented 9 years ago

I searched for «login» and I didn’t find anything in the man page, so it’s my fault.

But it seems the netrc feature is not documented (How should I format the file?! Why youtube-dl ignore it even with -n or --netrc flag?), but I finally figured out that I need to use single quotes so that my username and password are not interpreted by the shell.

There’s a valid nicovideo account in the source code, but I don’t know how to use it.

naglis commented 9 years ago

Yes, the --netrc flag was indeed ignored in case of niconico. It's should be fixed in version 2014.10.12 and newer.

Example contents of .netrc file to use with niconico:

machine niconico
login you@example.com
password your_password

Just change the email and password to those of your account. More information on the .netrc file.

We can't stop you from using the credentials found in the source code, however, I am not sure if this is encouraged (@phihag, what do think?).

ariasuni commented 9 years ago

Thank you very much.

We can't stop you from using the credentials found in the source code, however, I am not sure if this is encouraged (@phihag, what do think?).

Why are there here in the first place? I wondered if they can be used by using a particular flag, but it doesn’t seem so.

phihag commented 9 years ago

The credentials in the source code are just for testing the login code.

While we cannot hinder you to use them, we do not support or condone their usage for anything but testing the niconico's extractor login code. Experience shows that the password may be changed or the account deleted at some time.

phihag commented 9 years ago

You can now log in to niconico both with command-line options as well as netrc in youtube-dl 2014.10.12. Refer to our FAQ on how to update.

I've also added the keyword login to the --help output (our documentation will be generated from that in the next release).