@@ -14,6 +14,7 @@ class ArtistUrl < ActiveRecord::Base
|
||||
url = url.gsub(/^http:\/\/blog-imgs-\d+\.fc2/, "http://blog.fc2")
|
||||
url = url.gsub(/^http:\/\/blog-imgs-\d+-\w+\.fc2/, "http://blog.fc2")
|
||||
url = url.sub(%r!(http://seiga.nicovideo.jp/user/illust/\d+)\?.+!, '\1')
|
||||
url = url.sub(%r!^http://pictures.hentai-foundry.com//!, "http://pictures.hentai-foundry.com/")
|
||||
begin
|
||||
url = Sources::Site.new(url).normalize_for_artist_finder!
|
||||
rescue PixivApiClient::Error
|
||||
|
||||
10
script/fixes/036_fix_hentai_foundry_artist_urls.rb
Normal file
10
script/fixes/036_fix_hentai_foundry_artist_urls.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment'))
|
||||
|
||||
ActiveRecord::Base.connection.execute("set statement_timeout = 0")
|
||||
|
||||
CurrentUser.user = User.admins.first
|
||||
CurrentUser.ip_addr = "127.0.0.1"
|
||||
|
||||
ArtistUrl.where("normalized_url like 'http://pictures.hentai-foundry.com//%'").update_all("normalized_url = replace(normalized_url, 'http://pictures.hentai-foundry.com//', 'http://pictures.hentai-foundry.com/')")
|
||||
@@ -44,6 +44,11 @@ class ArtistUrlTest < ActiveSupport::TestCase
|
||||
assert_equal("http://seiga.nicovideo.jp/user/illust/1826959/", url.normalized_url)
|
||||
end
|
||||
|
||||
should "normalize hentai foundry artist urls" do
|
||||
url = FactoryGirl.create(:artist_url, :url => "http://pictures.hentai-foundry.com//a/AnimeFlux/219123.jpg")
|
||||
assert_equal("http://pictures.hentai-foundry.com/a/AnimeFlux/219123.jpg/", url.normalized_url)
|
||||
end
|
||||
|
||||
should "normalize pixiv urls" do
|
||||
url = FactoryGirl.create(:artist_url, :url => "http://img55.pixiv.net/img/monet")
|
||||
assert_equal("http://img55.pixiv.net/img/monet", url.url)
|
||||
|
||||
Reference in New Issue
Block a user