nijie: fix page_url method.
The id in a bare image url is the member id, not the illust id.
This commit is contained in:
@@ -41,10 +41,6 @@ module Sources
|
||||
if x =~ %r!https?://nijie\.info/view_popup\.php.+id=(\d+)!
|
||||
return "https://nijie.info/view.php?id=#{$1}"
|
||||
end
|
||||
|
||||
if x =~ %r!\Ahttps?://pic\d+\.nijie\.info/nijie_picture/(\d+)!
|
||||
return "https://nijie.info/view.php?id=#{$1}"
|
||||
end
|
||||
end
|
||||
|
||||
return super
|
||||
|
||||
@@ -164,7 +164,7 @@ class ArtistUrlTest < ActiveSupport::TestCase
|
||||
|
||||
should "normalize nijie urls" do
|
||||
url = FactoryBot.create(:artist_url, url: "https://pic03.nijie.info/nijie_picture/236014_20170620101426_0.png")
|
||||
assert_equal("http://nijie.info/members.php?id=161703/", url.normalized_url)
|
||||
assert_equal("http://nijie.info/members.php?id=236014/", url.normalized_url)
|
||||
|
||||
url = FactoryBot.create(:artist_url, url: "https://nijie.info/members.php?id=161703")
|
||||
assert_equal("http://nijie.info/members.php?id=161703/", url.normalized_url)
|
||||
|
||||
@@ -121,5 +121,17 @@ module Sources
|
||||
assert_equal(desc, @site.dtext_artist_commentary_desc)
|
||||
end
|
||||
end
|
||||
|
||||
context "The source site for a nijie image url without referer" do
|
||||
should "get the correct urls" do
|
||||
image_url = "https://pic03.nijie.info/nijie_picture/236014_20170620101426_0.png"
|
||||
site = Sources::Strategies.find(image_url)
|
||||
|
||||
assert_nil(site.page_url)
|
||||
assert_equal(image_url, site.image_url)
|
||||
assert_equal(image_url, site.canonical_url)
|
||||
assert_equal("https://nijie.info/members.php?id=236014", site.profile_url)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user