pixiv: fix preview_urls to use correct url (#3891).
This commit is contained in:
@@ -12,6 +12,7 @@ module Sources
|
|||||||
IMG = %r!(?:\A(?:https?://)?img[0-9]*\.pixiv\.net)!
|
IMG = %r!(?:\A(?:https?://)?img[0-9]*\.pixiv\.net)!
|
||||||
PXIMG = %r!(?:\A(?:https?://)?i\.pximg\.net)!
|
PXIMG = %r!(?:\A(?:https?://)?i\.pximg\.net)!
|
||||||
TOUCH = %r!(?:\A(?:https?://)?touch\.pixiv\.net)!
|
TOUCH = %r!(?:\A(?:https?://)?touch\.pixiv\.net)!
|
||||||
|
ORIG_IMAGE = %r!#{PXIMG}/img-original/img/(?<date>\d{4}/\d{2}/\d{2}/\d{2}/\d{2}/\d{2})/(?<illust_id>\d+)_p(?<page>\d+)\.#{EXT}\z!i
|
||||||
STACC_PAGE = %r!\A#{WEB}/stacc/#{MONIKER}/?\z!i
|
STACC_PAGE = %r!\A#{WEB}/stacc/#{MONIKER}/?\z!i
|
||||||
NOVEL_PAGE = %r!(?:\Ahttps?://www\.pixiv\.net/novel/show\.php\?id=(\d+))!
|
NOVEL_PAGE = %r!(?:\Ahttps?://www\.pixiv\.net/novel/show\.php\?id=(\d+))!
|
||||||
FANBOX_ACCOUNT = %r!(?:\Ahttps?://www\.pixiv\.net/fanbox/creator/\d+\z)!
|
FANBOX_ACCOUNT = %r!(?:\Ahttps?://www\.pixiv\.net/fanbox/creator/\d+\z)!
|
||||||
@@ -52,7 +53,9 @@ module Sources
|
|||||||
|
|
||||||
def preview_urls
|
def preview_urls
|
||||||
image_urls.map do |x|
|
image_urls.map do |x|
|
||||||
x.sub(%r!pximg\.net/img-original/img!, "pximg.net/c/240x240/img-master/img")
|
x.sub(ORIG_IMAGE) do
|
||||||
|
"https://i.pximg.net/c/240x240/img-master/img/#{$~[:date]}/#{$~[:illust_id]}_p#{$~[:page]}_master1200.jpg"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ module Sources
|
|||||||
end
|
end
|
||||||
|
|
||||||
should "get the preview size image url" do
|
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.jpg", @site.preview_url)
|
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
|
end
|
||||||
|
|
||||||
should "get the page count" do
|
should "get the page count" do
|
||||||
|
|||||||
Reference in New Issue
Block a user