sources: factor out Source::URL::Pixiv.

* Drop support for preview_urls. This means that IQDB lookups may be
  slower, especially for ugoiras, since we have to download the full
  ugoira now. However, ugoira lookups should produce better results,
  since the ugoira thumbnail chosen by Pixiv wasn't necessarily the same
  as the thumbnail chosen by Danbooru.

* Drop support for uploading single manga pages:

    http://www.pixiv.net/member_illust.php?mode=manga_big&illust_id=18557054&page=2

  Previously uploading an URL like this would only upload a single image
  out of a multi-image work. Now it will upload all images in the work.
  Pixiv no longer supports URLs like this, so we don't either.

* Add support for parsing URLs like this:

    https://i.pximg.net/c/360x360_70/custom-thumb/img/2022/03/08/00/00/56/96755248_p0_custom1200.jpg

  Apparently artists can choose a custom thumbnail now (not like anyone
  will try to upload one though).
This commit is contained in:
evazion
2022-03-08 22:06:24 -06:00
parent df0bb70486
commit 1c620f8055
3 changed files with 155 additions and 176 deletions

View File

@@ -8,7 +8,7 @@ module Sources
def assert_illust_id(illust_id, url)
site = Sources::Strategies.find(url)
assert_equal(illust_id, site.illust_id)
assert_equal(illust_id, site.illust_id.to_i)
assert_nothing_raised { site.to_h }
end
@@ -43,10 +43,6 @@ module Sources
assert_equal("https://i.pximg.net/img-zip-ugoira/img/2017/04/04/08/57/38/62247364_ugoira1920x1080.zip", @site.file_url)
end
should "get the preview url" do
assert_equal("https://i.pximg.net/c/240x240/img-master/img/2017/04/04/08/57/38/62247364_master1200.jpg", @site.preview_url)
end
should "capture the frame data" do
media_file = @site.download_file!
@@ -103,10 +99,6 @@ module Sources
assert_equal("https://i.pximg.net/img-original/img/2017/11/21/05/12/37/65981735_p0.jpg", @site.image_url)
end
should "get the preview size image url" do
assert_equal("https://i.pximg.net/c/240x240/img-master/img/2017/11/21/05/12/37/65981735_p0_master1200.jpg", @site.preview_url)
end
should "get the page count" do
assert_equal(1, @site.image_urls.size)
end