Normalize URLs to the mode=medium page correctly.
This handles a few new cases that weren't handled correctly previously. * http://i1.pixiv.net/img-zip-ugoira/img/2014/10/03/17/29/16/46323924_ugoira1920x1080.zip * http://i1.pixiv.net/c/600x600/img-master/img/2014/10/02/13/51/23/46304396_p0_master1200.jpg * http://www.pixiv.net/member_illust.php?mode=manga&illust_id=18557054 * http://www.pixiv.net/member_illust.php?mode=manga_big&illust_id=18557054&page=1 * http://www.pixiv.net/i/18557054
This commit is contained in:
@@ -112,17 +112,8 @@ module Sources
|
||||
end
|
||||
|
||||
def normalized_url
|
||||
@normalized_url ||= begin
|
||||
if url =~ /\/(\d+)(?:_big)?(?:_m|_p\d+)?\.(?:jpg|jpeg|png|gif)/i
|
||||
"http://www.pixiv.net/member_illust.php?mode=medium&illust_id=#{$1}"
|
||||
elsif url =~ /mode=big/
|
||||
url.sub(/mode=big/, "mode=medium")
|
||||
elsif url =~ /member_illust\.php/ && url =~ /illust_id=/
|
||||
url
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
illust_id = illust_id_from_url(@url)
|
||||
"http://www.pixiv.net/member_illust.php?mode=medium&illust_id=#{illust_id}"
|
||||
end
|
||||
|
||||
# Refer to http://danbooru.donmai.us/wiki_pages/58938 for documentation on the Pixiv API.
|
||||
|
||||
Reference in New Issue
Block a user