add login notifications

This commit is contained in:
Mike Fährmann
2017-03-17 09:42:59 +01:00
parent ed94d9b92d
commit 1d46be545c
5 changed files with 15 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2014-2016 Mike Fährmann # Copyright 2014-2017 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License version 2 as
@@ -32,6 +32,7 @@ class BatotoExtractor(Extractor):
@cache(maxage=360*24*60*60, keyarg=1) @cache(maxage=360*24*60*60, keyarg=1)
def _login_impl(self, username, password): def _login_impl(self, username, password):
"""Actual login implementation""" """Actual login implementation"""
self.log.info("Logging in as %s", username)
page = self.request(self.root).text page = self.request(self.root).text
auth = text.extract(page, "name='auth_key' value='", "'")[0] auth = text.extract(page, "name='auth_key' value='", "'")[0]
params = { params = {

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2014-2016 Mike Fährmann # Copyright 2014-2017 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License version 2 as
@@ -191,9 +191,10 @@ class ExhentaiGalleryExtractor(Extractor):
self.session.cookies.set( self.session.cookies.set(
key, value, domain=".exhentai.org", path="/") key, value, domain=".exhentai.org", path="/")
@cache(maxage=360*24*60*60, keyarg=1) @cache(maxage=90*24*60*60, keyarg=1)
def _login_impl(self, username, password): def _login_impl(self, username, password):
"""Actual login implementation""" """Actual login implementation"""
self.log.info("Logging in as %s", username)
cnames = ["ipb_member_id", "ipb_pass_hash"] cnames = ["ipb_member_id", "ipb_pass_hash"]
try: try:

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2015, 2016 Mike Fährmann # Copyright 2015-2017 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License version 2 as
@@ -69,6 +69,7 @@ class NijieExtractor(AsynchronousExtractor):
@cache(maxage=30*24*60*60, keyarg=1) @cache(maxage=30*24*60*60, keyarg=1)
def _login_impl(self, username, password): def _login_impl(self, username, password):
"""Actual login implementation""" """Actual login implementation"""
self.log.info("Logging in as %s", username)
params = {"email": username, "password": password} params = {"email": username, "password": password}
page = self.session.post("https://nijie.info/login_int.php", page = self.session.post("https://nijie.info/login_int.php",
data=params).text data=params).text

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2014-2016 Mike Fährmann # Copyright 2014-2017 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License version 2 as
@@ -37,7 +37,7 @@ class PixivUserExtractor(Extractor):
def __init__(self, match): def __init__(self, match):
Extractor.__init__(self) Extractor.__init__(self)
self.artist_id = match.group(1) self.artist_id = match.group(1)
self.api = PixivAPI(self.session) self.api = PixivAPI(self)
self.api_call = self.api.user_works self.api_call = self.api.user_works
self.load_ugoira = config.interpolate( self.load_ugoira = config.interpolate(
("extractor", "pixiv", "ugoira"), True ("extractor", "pixiv", "ugoira"), True
@@ -230,8 +230,9 @@ class PixivAPI():
For in-depth information regarding the Pixiv Public-API, see For in-depth information regarding the Pixiv Public-API, see
- http://blog.imaou.com/opensource/2014/10/09/pixiv_api_for_ios_update.html - http://blog.imaou.com/opensource/2014/10/09/pixiv_api_for_ios_update.html
""" """
def __init__(self, session): def __init__(self, extractor):
self.session = session self.session = extractor.session
self.log = extractor.log
self.session.headers.update({ self.session.headers.update({
"Referer": "http://www.pixiv.net/", "Referer": "http://www.pixiv.net/",
"User-Agent": "PixivIOSApp/5.8.0", "User-Agent": "PixivIOSApp/5.8.0",
@@ -298,6 +299,7 @@ class PixivAPI():
@cache(maxage=50*60, keyarg=1) @cache(maxage=50*60, keyarg=1)
def _login_impl(self, username, password): def _login_impl(self, username, password):
"""Actual login implementation""" """Actual login implementation"""
self.log.info("Logging in as %s", username)
data = { data = {
"username": username, "username": username,
"password": password, "password": password,

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2016, 2017 Mike Fährmann # Copyright 2016-2017 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License version 2 as
@@ -54,6 +54,7 @@ class SeigaExtractor(Extractor):
@cache(maxage=30*24*60*60, keyarg=1) @cache(maxage=30*24*60*60, keyarg=1)
def _login_impl(self, username, password): def _login_impl(self, username, password):
"""Actual login implementation""" """Actual login implementation"""
self.log.info("Logging in as %s", username)
url = "https://account.nicovideo.jp/api/v1/login" url = "https://account.nicovideo.jp/api/v1/login"
params = {"mail_tel": username, "password": password} params = {"mail_tel": username, "password": password}
self.session.post(url, data=params).close() self.session.post(url, data=params).close()