Remove categories that were causing issues
This commit is contained in:
parent
0e0f5650e6
commit
61f0903c19
|
@ -26,16 +26,11 @@ Category:Quality images of Buteo jamaicensis
|
|||
Category:Quality images of Buteo lineatus
|
||||
Category:Quality images of Buteo regalis
|
||||
Category:Quality images of Buteogallus
|
||||
Category:Quality images of Aquila
|
||||
Category:Quality images of Buteo
|
||||
Category:Quality images of Circaetus
|
||||
Category:Quality images of Circaetus gallicus
|
||||
Category:Quality images of Circaetus pectoralis
|
||||
Category:Quality_images_of_Circus
|
||||
Category:Quality images of Circus aeruginosus
|
||||
Category:Quality images of Circus cyaneus
|
||||
Category:Quality images of Circus hudsonius
|
||||
Category:Quality_images_of_Haliaeetus
|
||||
Category:Quality images of Haliaeetus albicilla
|
||||
Category:Quality images of Haliaeetus leucocephalus
|
||||
Category:Quality images of Haliaeetus leucogaster
|
||||
|
|
|
@ -6,6 +6,8 @@ def get_images_by_category(categories)
|
|||
random_category = random_category.gsub("Category:", "")
|
||||
end
|
||||
|
||||
puts random_category
|
||||
|
||||
photos = []
|
||||
|
||||
conn = Faraday.new(url: 'https://commons.wikimedia.org/w/api.php') do |faraday|
|
||||
|
|
|
@ -18,6 +18,7 @@ def get_random_image(photos)
|
|||
req.params = params
|
||||
end
|
||||
|
||||
begin
|
||||
data = JSON.parse(response.body)
|
||||
info = data['query']['pages'].values.first
|
||||
user = info['imageinfo'].first['user']
|
||||
|
@ -27,6 +28,10 @@ def get_random_image(photos)
|
|||
license_url = info['imageinfo'].first['extmetadata']['LicenseUrl']['value']
|
||||
desc = info['imageinfo'].first['extmetadata']['ImageDescription']['value']
|
||||
thumb = info['imageinfo'].first['thumburl']
|
||||
rescue
|
||||
puts "ERROR OCCURRED"
|
||||
return {:user => user, :url => url, :thumb => thumb, :license => license, :desc => desc, :license_url => license_url, :user_url => user_url}
|
||||
end
|
||||
|
||||
return {:user => user, :url => url, :thumb => thumb, :license => license, :desc => desc, :license_url => license_url, :user_url => user_url}
|
||||
end
|
Loading…
Reference in New Issue