You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for the love of ruby, can we also implement Geolocation Filtering: Ability to filter photos based on geolocation data, if available. In addition,Date Range Filtering: Ability to search photos within a specific date range.
require'pexels'require'open-uri'# # Ensure that the API key is set in the environment variable PEXELS_API_KEYclient=Pexels::Client.new(ENV['PEXELS_API_KEY'])client=Pexels::Client.newdefdownload_image(url,filename)File.open(filename,'wb')do |file|
file.write(URI.open(url).read)endendphotos=client.photos.search('United Kingdom',per_page: 2,page: 1,geolocation: '51.4875, -0.1694',# Latitude and Longitude of Chelsea, Londondate_range: '2023-01-01,2023-10-28'# Example: Download photos uploaded between Jan 1, 2023, and Oct 28, 2023)photos.photos.each_with_indexdo |photo,index|
download_image(photo.src['original'],"photo_#{index + 1}.jpg")puts"Downloaded photo_#{index + 1}.jpg"end
The text was updated successfully, but these errors were encountered:
for the love of ruby, can we also implement Geolocation Filtering: Ability to filter photos based on geolocation data, if available. In addition,Date Range Filtering: Ability to search photos within a specific date range.
The text was updated successfully, but these errors were encountered: