From: Sergey M. Date: Fri, 4 Jul 2014 15:25:05 +0000 (+0700) Subject: Merge pull request #3180 from hakatashi/niconico-without-authentication X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=165c46690f51585b96a4dff2fac8b4e0c4825231;p=youtube-dl Merge pull request #3180 from hakatashi/niconico-without-authentication [niconico] Download without authentication --- 165c46690f51585b96a4dff2fac8b4e0c4825231 diff --cc youtube_dl/extractor/niconico.py index 31f60041c,ba7464cb8..d98131271 --- a/youtube_dl/extractor/niconico.py +++ b/youtube_dl/extractor/niconico.py @@@ -38,11 -37,17 +38,17 @@@ class NiconicoIE(InfoExtractor) }, } - _VALID_URL = r'^https?://(?:www\.|secure\.)?nicovideo\.jp/watch/([a-z][a-z][0-9]+)(?:.*)$' + _VALID_URL = r'https?://(?:www\.|secure\.)?nicovideo\.jp/watch/((?:[a-z]{2})?[0-9]+)' _NETRC_MACHINE = 'niconico' + # Determine whether the downloader uses authentication to download video + _AUTHENTICATE = False def _real_initialize(self): - self._login() + if self._downloader.params.get('username', None) is not None: + self._AUTHENTICATE = True + + if self._AUTHENTICATE: + self._login() def _login(self): (username, password) = self._get_login_info()