raise error when required username or password are missing

do not try to login as 'None' (#1192)
This commit is contained in:
Mike Fährmann
2020-12-22 14:40:18 +01:00
parent b233531aaa
commit b58e605dc7
3 changed files with 13 additions and 1 deletions

View File

@@ -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"}

View File

@@ -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,

View File

@@ -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}