rely on preview urls if available for gallery
This commit is contained in:
@@ -53,6 +53,16 @@ module Sources
|
||||
image_urls.first
|
||||
end
|
||||
|
||||
# A smaller representation of the image that's suitable for
|
||||
# displaying previews.
|
||||
def preview_urls
|
||||
image_urls
|
||||
end
|
||||
|
||||
def preview_url
|
||||
preview_urls.first
|
||||
end
|
||||
|
||||
# Whatever <tt>url</tt> is, this method should return a link to the HTML
|
||||
# page containing the resource. It should not be a binary file. It will
|
||||
# eventually be assigned as the source for the post, but it does not
|
||||
|
||||
@@ -50,6 +50,12 @@ module Sources
|
||||
[url]
|
||||
end
|
||||
|
||||
def preview_urls
|
||||
image_urls.map do |x|
|
||||
x.sub(%r!pximg\.net/img-original/img!, "pximg.net/c/240x240/img-master/img")
|
||||
end
|
||||
end
|
||||
|
||||
def page_url
|
||||
if novel_id.present?
|
||||
return "https://www.pixiv.net/novel/show.php?id=#{novel_id}&mode=cover"
|
||||
|
||||
@@ -36,6 +36,12 @@ module Sources::Strategies
|
||||
.uniq
|
||||
end
|
||||
|
||||
def preview_urls
|
||||
image_urls.map do |x|
|
||||
x.sub(%r!_1280\.(jpg|png|gif|jpeg)\z!, '_250.\1')
|
||||
end
|
||||
end
|
||||
|
||||
def page_url
|
||||
[url, referer_url].each do |x|
|
||||
if x =~ POST
|
||||
|
||||
@@ -36,6 +36,12 @@ module Sources::Strategies
|
||||
end
|
||||
memoize :image_urls
|
||||
|
||||
def preview_urls
|
||||
image_urls.map do |x|
|
||||
x.sub(%r!\.(jpg|jpeg|png|gif)(?::orig)?\z!i, '.\1:small')
|
||||
end
|
||||
end
|
||||
|
||||
def page_url
|
||||
[url, referer_url].each do |x|
|
||||
if self.class.status_id_from_url(x).present?
|
||||
|
||||
Reference in New Issue
Block a user