fix artist url spec and bug with nicoseiga strategy not recognizing urls
This commit is contained in:
@@ -2,7 +2,8 @@ module Sources
|
|||||||
module Strategies
|
module Strategies
|
||||||
class NicoSeiga < Base
|
class NicoSeiga < Base
|
||||||
URL = %r!\Ahttps?://(?:\w+\.)?nico(?:seiga|video)\.jp!
|
URL = %r!\Ahttps?://(?:\w+\.)?nico(?:seiga|video)\.jp!
|
||||||
DIRECT = %r!\Ahttps?://lohas\.nicoseiga\.jp/priv/[0-9a-f]+!
|
DIRECT1 = %r!\Ahttps?://lohas\.nicoseiga\.jp/priv/[0-9a-f]+!
|
||||||
|
DIRECT2 = %r!\Ahttps?://lohas\.nicoseiga\.jp/o/[0-9a-f]+/\d+/\d+!
|
||||||
PAGE = %r!\Ahttps?://seiga\.nicovideo\.jp/seiga/im(\d+)!i
|
PAGE = %r!\Ahttps?://seiga\.nicovideo\.jp/seiga/im(\d+)!i
|
||||||
PROFILE = %r!\Ahttps?://seiga\.nicovideo\.jp/user/illust/(\d+)!i
|
PROFILE = %r!\Ahttps?://seiga\.nicovideo\.jp/user/illust/(\d+)!i
|
||||||
|
|
||||||
@@ -15,7 +16,7 @@ module Sources
|
|||||||
end
|
end
|
||||||
|
|
||||||
def image_urls
|
def image_urls
|
||||||
if url =~ DIRECT
|
if url =~ DIRECT1
|
||||||
return [url]
|
return [url]
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -100,7 +101,7 @@ module Sources
|
|||||||
end
|
end
|
||||||
|
|
||||||
def normalizable_for_artist_finder?
|
def normalizable_for_artist_finder?
|
||||||
url =~ PAGE || url =~ PROFILE
|
url =~ PAGE || url =~ PROFILE || url =~ DIRECT1 || url =~ DIRECT2
|
||||||
end
|
end
|
||||||
|
|
||||||
def normalize_for_artist_finder
|
def normalize_for_artist_finder
|
||||||
|
|||||||
@@ -89,9 +89,9 @@ class ArtistUrlTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
should "normalize" do
|
should "normalize" do
|
||||||
assert_equal("http://seiga.nicovideo.jp/user/illust/7017777", @urls[0].normalized_url)
|
assert_equal("http://seiga.nicovideo.jp/user/illust/7017777/", @urls[0].normalized_url)
|
||||||
assert_equal("http://seiga.nicovideo.jp/user/illust/7017777", @urls[1].normalized_url)
|
assert_equal("http://seiga.nicovideo.jp/user/illust/7017777/", @urls[1].normalized_url)
|
||||||
assert_equal("http://seiga.nicovideo.jp/user/illust/7017777", @urls[2].normalized_url)
|
assert_equal("http://seiga.nicovideo.jp/user/illust/7017777/", @urls[2].normalized_url)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user