Fix #3877: Add sta.sh strategy.
Co-authored-by: lllusion3469 <31420484+lllusion3469@users.noreply.github.com>
This commit is contained in:
@@ -198,15 +198,19 @@ module Sources
|
||||
self.class.artist_name_from_url(url) || self.class.artist_name_from_url(referer_url)
|
||||
end
|
||||
|
||||
def page
|
||||
def api_url
|
||||
return nil if deviation_id.blank?
|
||||
deviation_url = "https://www.deviantart.com/deviation/#{deviation_id}"
|
||||
"https://www.deviantart.com/deviation/#{deviation_id}"
|
||||
end
|
||||
|
||||
def page
|
||||
return nil if api_url.blank?
|
||||
|
||||
options = Danbooru.config.httparty_options.deep_merge(
|
||||
format: :plain,
|
||||
headers: { "Accept-Encoding" => "gzip" }
|
||||
)
|
||||
resp = HTTParty.get(deviation_url, **options)
|
||||
resp = HTTParty.get(api_url, **options)
|
||||
|
||||
if resp.success?
|
||||
body = Zlib.gunzip(resp.body)
|
||||
|
||||
Reference in New Issue
Block a user