nijie: replace Mechanize with Danbooru::Http.

The Nijie login process works like this:

* First we submit our `email` and `password` to `https://nijie.info/login_int.php`.
* Then we save the NIJIEIEID session cookie from the response.
* We optionally retry if login failed. Nijie returns 429 errors with a
  `Retry-After: 5` header if we send too many login requests. This can
  happen during parallel testing.
* We cache the login cookies for only 1 hour so we don't have to worry
  about them becoming invalid if we cache them too long.

Cookies and retrying errors on failure are handled transparently by Danbooru::Http.
This commit is contained in:
evazion
2020-06-20 23:08:38 -05:00
parent 05d7355ebb
commit 6e6ce6e62f
2 changed files with 8 additions and 46 deletions

View File

@@ -187,8 +187,6 @@ module Sources
desc = <<-EOS.strip_heredoc.chomp
foo [b]bold[/b] [i]italics[/i] [s]strike[/s] red
<http://nijie.info/view.php?id=218944>
EOS