X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fyoutube.py;h=61b7b561f46e4dbe835704dd24d79c358c27278b;hb=81f0259b9e4321b612c90709a043ff90d2b0a774;hp=537f884062afdcfb6f33545038e8b397e71c7e9c;hpb=20c3893f0ea7c341ed015a15cec951ab4f7c8748;p=youtube-dl.git diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py index 537f88406..61b7b561f 100644 --- a/youtube_dl/extractor/youtube.py +++ b/youtube_dl/extractor/youtube.py @@ -131,10 +131,6 @@ class YoutubeIE(InfoExtractor): """Report attempt to set language.""" self.to_screen(u'Setting language') - def report_login(self): - """Report attempt to log in.""" - self.to_screen(u'Logging in') - def report_video_webpage_download(self, video_id): """Report attempt to download video webpage.""" self.to_screen(u'%s: Downloading video webpage' % video_id) @@ -296,26 +292,6 @@ class YoutubeIE(InfoExtractor): if self._downloader is None: return - username = None - password = None - downloader_params = self._downloader.params - - # Attempt to use provided username and password or .netrc data - if downloader_params.get('username', None) is not None: - username = downloader_params['username'] - password = downloader_params['password'] - elif downloader_params.get('usenetrc', False): - try: - info = netrc.netrc().authenticators(self._NETRC_MACHINE) - if info is not None: - username = info[0] - password = info[2] - else: - raise netrc.NetrcParseError('No authenticators for %s' % self._NETRC_MACHINE) - except (IOError, netrc.NetrcParseError) as err: - self._downloader.report_warning(u'parsing .netrc: %s' % compat_str(err)) - return - # Set language request = compat_urllib_request.Request(self._LANG_URL) try: @@ -325,6 +301,8 @@ class YoutubeIE(InfoExtractor): self._downloader.report_warning(u'unable to set language: %s' % compat_str(err)) return + (username, password) = self._get_login_info() + # No authentication to be performed if username is None: return @@ -887,6 +865,12 @@ class YoutubeSubscriptionsIE(YoutubeIE): def suitable(cls, url): return re.match(cls._VALID_URL, url) is not None + def _real_initialize(self): + (username, password) = self._get_login_info() + if username is None: + raise ExtractorError(u'No login info available, needed for downloading the Youtube subscriptions.', expected=True) + super(YoutubeSubscriptionsIE, self)._real_initialize() + def _real_extract(self, url): feed_entries = [] # The step argument is available only in 2.7 or higher