From b58e605dc755bbf03c27888575d195e6670b319e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Tue, 22 Dec 2020 14:40:18 +0100 Subject: [PATCH] raise error when required username or password are missing do not try to login as 'None' (#1192) --- gallery_dl/extractor/nijie.py | 4 ++++ gallery_dl/extractor/pixiv.py | 4 ++++ gallery_dl/extractor/seiga.py | 6 +++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gallery_dl/extractor/nijie.py b/gallery_dl/extractor/nijie.py index 2394acff..e558513b 100644 --- a/gallery_dl/extractor/nijie.py +++ b/gallery_dl/extractor/nijie.py @@ -100,6 +100,10 @@ class NijieExtractor(AsynchronousMixin, Extractor): @cache(maxage=150*24*3600, keyarg=1) def _login_impl(self, username, password): + if not username or not password: + raise exception.AuthenticationError( + "Username and password required") + self.log.info("Logging in as %s", username) url = "{}/login_int.php".format(self.root) data = {"email": username, "password": password, "save": "on"} diff --git a/gallery_dl/extractor/pixiv.py b/gallery_dl/extractor/pixiv.py index a813d0ef..1601031c 100644 --- a/gallery_dl/extractor/pixiv.py +++ b/gallery_dl/extractor/pixiv.py @@ -522,6 +522,10 @@ class PixivAppAPI(): @cache(maxage=3600, keyarg=1) def _login_impl(self, username, password): + if not username or not password: + raise exception.AuthenticationError( + "Username and password required") + url = "https://oauth.secure.pixiv.net/auth/token" data = { "client_id": self.client_id, diff --git a/gallery_dl/extractor/seiga.py b/gallery_dl/extractor/seiga.py index b32a1705..7f9130d8 100644 --- a/gallery_dl/extractor/seiga.py +++ b/gallery_dl/extractor/seiga.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2016-2019 Mike Fährmann +# Copyright 2016-2020 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -54,6 +54,10 @@ class SeigaExtractor(Extractor): @cache(maxage=7*24*3600, keyarg=1) def _login_impl(self, username, password): + if not username or not password: + raise exception.AuthenticationError( + "Username and password required") + self.log.info("Logging in as %s", username) url = "https://account.nicovideo.jp/api/v1/login" data = {"mail_tel": username, "password": password}