Fix bookmarklet for whitecube URLs.
Make the bookmarklet work for URLs like this: * http://www.pixiv.net/whitecube/user/607414/illust/59510800 * http://www.pixiv.net/whitecube/user/772090/illust/59595705
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
module Sources
|
||||
module Strategies
|
||||
class PixivWhitecube < Base
|
||||
attr_reader :artist_commentary_title, :artist_commentary_desc, :ugoira_frame_data, :ugoira_content_type
|
||||
|
||||
# sample: http://www.pixiv.net/whitecube/user/277898/illust/59182257
|
||||
WHITECUBE_ILLUST = %r!^https?://www\.pixiv\.net/whitecube/user/\d+/illust/\d+!i
|
||||
|
||||
@@ -43,7 +45,7 @@ module Sources
|
||||
@artist_name = @data.name
|
||||
@profile_url = "https://www.pixiv.net/whitecube/user/" + @data.user_id.to_s
|
||||
@pixiv_moniker = @data.moniker
|
||||
@zip_url, @ugoira_frame_data = get_zip_url_from_api(@data)
|
||||
@zip_url, @ugoira_frame_data, @ugoira_content_type = get_zip_url_from_api(@data)
|
||||
@tags = @data.tags
|
||||
@page_count = @data.page_count
|
||||
@artist_commentary_title = @data.artist_commentary_title
|
||||
@@ -56,6 +58,14 @@ module Sources
|
||||
end
|
||||
end
|
||||
|
||||
def file_url
|
||||
@image_url || @zip_url
|
||||
end
|
||||
|
||||
def rewrite_thumbnails(url)
|
||||
url
|
||||
end
|
||||
|
||||
def illust_id_from_url
|
||||
# http://www.pixiv.net/whitecube/user/277898/illust/59182257
|
||||
if url =~ %r!/whitecube/user/\d+/illust/(\d+)!
|
||||
@@ -75,7 +85,7 @@ module Sources
|
||||
zip_url = data.json["metadata"]["zip_urls"]["ugoira600x600"].sub("_ugoira600x600.zip", "_ugoira1920x1080.zip")
|
||||
frame_data = data.json["metadata"]["frames"]
|
||||
|
||||
return [zip_url, frame_data]
|
||||
return [zip_url, frame_data, "image/png"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user