pixiv: avoid unnecessary API call when uploading Pixiv posts.
Do one less API call when fetching the image URLs for a Pixiv post. The `is_ugoira?` check in `image_urls` caused us to do an extra API call when fetching the image URLs for a non-ugoira post. API calls to Pixiv take around ~800ms, so this reduces minimum upload time for Pixiv posts from ~1.6 seconds (two calls) to ~0.8 seconds.
This commit is contained in:
@@ -223,7 +223,7 @@ module Sources
|
||||
|
||||
def is_ugoira?
|
||||
# https://i.pximg.net/img-original/img/2019/05/27/17/59/33/74932152_ugoira0.jpg
|
||||
url.match?(UGOIRA) || api_illust.dig(:urls, :original)&.match?(/ugoira/)
|
||||
url.match?(UGOIRA) || original_urls&.any?(/ugoira/)
|
||||
end
|
||||
|
||||
def illust_id
|
||||
|
||||
Reference in New Issue
Block a user