https://github.com/rztprog/unsplash-scraper-service
Random unsplash url image scraper without API in Ruby
https://github.com/rztprog/unsplash-scraper-service
images random ruby scraper seed unsplash url
Last synced: 10 months ago
JSON representation
Random unsplash url image scraper without API in Ruby
- Host: GitHub
- URL: https://github.com/rztprog/unsplash-scraper-service
- Owner: rztprog
- Created: 2022-05-02T08:50:46.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-03T09:28:31.000Z (about 4 years ago)
- Last Synced: 2025-03-02T02:33:39.757Z (over 1 year ago)
- Topics: images, random, ruby, scraper, seed, unsplash, url
- Language: Ruby
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Unsplash-scraper-service
If you want a random unsplash url image scraper without the Unsplash API in Ruby, you can use this.
## Requirements
1. Gem open-uri
2. Gem nokogiri
## How to use
1. Change the keyword in the rb file to search wathever you want
2. Put the rb file in initializer and call him with UnsplashScraperService.new.call
## Example for seed in rails
```
require "faker"
require_relative "../config/initializers/unsplash_scraper_service"
puts "How much Flat(s) you want ?"
loop_n = STDIN.gets.chomp
loop_n.to_i.times do
flat = Flat.new(
name: "#{Faker::Address.community} in #{Faker::Address.city}",
address: Faker::Address.full_address,
description: Faker::GreekPhilosophers.quote,
price_per_night: Faker::Number.within(range: 30..120),
number_of_guests: Faker::Number.within(range: 2..10),
picture: UnsplashScraperService.new.call
)
flat.save!
end
```