deviantart: remove #api_url
similar change in eba6440b8b
in case of #page it may get rid of the redirect if artist and title are
found
This commit is contained in:
@@ -103,8 +103,8 @@ module Sources
|
|||||||
def page_url
|
def page_url
|
||||||
if api_deviation.present?
|
if api_deviation.present?
|
||||||
api_deviation[:url]
|
api_deviation[:url]
|
||||||
elsif api_url.present?
|
elsif deviation_id.present?
|
||||||
api_url
|
page_url_from_image_url
|
||||||
else
|
else
|
||||||
""
|
""
|
||||||
end
|
end
|
||||||
@@ -243,19 +243,14 @@ module Sources
|
|||||||
self.class.title_from_url(url) || self.class.title_from_url(referer_url)
|
self.class.title_from_url(url) || self.class.title_from_url(referer_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
def api_url
|
|
||||||
return nil if deviation_id.blank?
|
|
||||||
"https://www.deviantart.com/deviation/#{deviation_id}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def page
|
def page
|
||||||
return nil if api_url.blank?
|
return nil if page_url_from_image_url.blank?
|
||||||
|
|
||||||
options = Danbooru.config.httparty_options.deep_merge(
|
options = Danbooru.config.httparty_options.deep_merge(
|
||||||
format: :plain,
|
format: :plain,
|
||||||
headers: { "Accept-Encoding" => "gzip" }
|
headers: { "Accept-Encoding" => "gzip" }
|
||||||
)
|
)
|
||||||
resp = HTTParty.get(api_url, **options)
|
resp = HTTParty.get(page_url_from_image_url, **options)
|
||||||
|
|
||||||
if resp.success?
|
if resp.success?
|
||||||
body = Zlib.gunzip(resp.body)
|
body = Zlib.gunzip(resp.body)
|
||||||
|
|||||||
@@ -32,11 +32,11 @@ module Sources
|
|||||||
end
|
end
|
||||||
|
|
||||||
def page_url
|
def page_url
|
||||||
"https://sta.sh/#{stash_id}"
|
page_url_from_image_url
|
||||||
end
|
end
|
||||||
|
|
||||||
def api_url
|
def page_url_from_image_url
|
||||||
page_url
|
"https://sta.sh/#{stash_id}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.stash_id_from_url(url)
|
def self.stash_id_from_url(url)
|
||||||
|
|||||||
Reference in New Issue
Block a user