Commit Graph

19 Commits

Author SHA1 Message Date
evazion
07e23204b6 rubocop: fix various Rubocop warnings. 2021-06-17 04:17:53 -05:00
evazion
44f826d8fa nicoseiga: optimize image_url method.
The image_url method makes a request to `https://seiga.nicovideo.jp/images/source/:image_id`
to see where this URL redirects to. Before we did a GET request, which caused it to download
the full image. This could fail with a timeout error if the download took too long. We also
cached the request, which caused the full image to be cached, even though we only need the
headers. Change it to a HEAD request so we don't have to download the entire image just to
check the URL.
2020-06-24 22:54:04 -05:00
evazion
5dbe08372b nicoseiga: remove accept_fetish_warning.
This should have been a cookie, but it doesn't matter because the
strategy still works without it.
2020-06-23 00:49:38 -05:00
evazion
8c6759bbd7 nicoseiga: fix login endpoint.
* Update the login endpoint. The old endpoint returns 404 now.

  POST https://account.nicovideo.jp/api/v1/login ->
  POST https://account.nicovideo.jp/login/redirector?site=seiga

* Let Danbooru::Http cache the login request instead of caching it manually.

* Let Danbooru::Http automatically follow redirects instead of dealing
  with the Location header manually.
2020-06-22 18:46:47 -05:00
evazion
05d7355ebb danbooru::http: support automatically following redirects.
Replace http.rb's builtin redirect following option with our own
redirect follower. This fixes an issue with http.rb losing cookies after
following a redirect.
2020-06-21 05:22:57 -05:00
evazion
7868e5045e nicoseiga: fix regression with http redirects.
3cdf67920 changed it so that Danbooru::Http follows redirects by
default. This broke some things in the Nico Seiga strategy, so disable
following redirects in the Nico Seiga API client for now.

Also change it so that Danbooru::Http follows redirects after a POST
request (by setting `strict: false`). Nico Seiga needs this because it
sends a redirect after we POST the login form.
2020-06-15 22:13:28 -05:00
nonamethanks
6fc4d3ec44 Nicoseiga: Add support for drm-served manga 2020-06-15 03:37:51 +02:00
nonamethanks
9f0e85e1b5 Refactor nicoseiga strategy
* Get rid of mechanize, fully switch to Danbooru::Http
* Switch to mobile api, improving speed
* Merge main and manga clients
* Add full support for manga pages
* Add support for anonymous and r-15 images
* Don't fail when attempting to upload oekaki direct links
* Various misc fixes
2020-06-15 03:37:51 +02:00
evazion
309821bf73 rubocop: fix various style issues. 2019-12-22 21:23:37 -06:00
evazion
41378bc8e3 sources: replace HttpartyCache with Danbooru::Http. 2019-12-15 17:06:58 -06:00
Albert Yi
c051103d35 fixes #4059: Incorrect commentary description from Nicoseiga in some cases 2019-02-25 15:58:07 -08:00
Albert Yi
f6a11e6363 remove residual code 2019-02-25 14:46:43 -08:00
Albert Yi
90ce42a537 add support for nico seiga manga (fixes #4060) 2019-02-25 14:44:45 -08:00
Albert Yi
266c7c0d5b cache api clients 2018-09-11 14:19:17 -07:00
Albert Yi
762dc3da24 Refactor sources 2018-08-24 12:10:51 -07:00
r888888888
97ce9cafac add httparty option config 2017-07-12 15:52:48 -07:00
r888888888
eb6c5e3af5 switch to httparty 2017-07-12 15:52:48 -07:00
evazion
047fb68f45 Fix #3117: Nicoseiga handler grabbing wrong commentary source
* `summary` is the wrong field. It's the list of comments left by users,
  not the artist's commentary.

* For some reason `doc.response.image.description` returns nil even
  though the description element exists. Switch to `Hash.from_xml` to
  avoid this.
2017-06-06 13:44:43 -05:00
r888888888
216ca06fee fixes #3100 2017-05-30 15:38:01 -07:00