Skip to content

A tool to scrape images from websites and compile them into a PDF

License

Notifications You must be signed in to change notification settings

uminocelo/koralreef

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Koral Reef 🪸

A Ruby gem that scrapes images from websites (including JavaScript-heavy ones) and compiles them into a PDF.

Installation

Add this line to your application's Gemfile:

gem 'koralreef'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install koralreef

Usage

Command Line

# Basic usage (scrapes all images)
$ koralreef https://example.com/gallery

# Scrape specific images with a CSS selector
$ koralreef -s ".product-image" https://example.com/products

# Specify output file
$ koralreef -o product_catalog.pdf https://example.com/products

# Run with visible browser (not headless)
$ koralreef --no-headless https://example.com/gallery

In Ruby Code

require 'koralreef'

# Basic usage
pdf_file = Koralreef.run(
  url: "https://example.com/gallery",
  selector: "img.gallery-image",
  output_file: "gallery.pdf",
  headless: true
)

puts "PDF created at: #{pdf_file}"

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/uminocelo/koralreef.

License

The gem is available as open source under the terms of the MIT License.

About

A tool to scrape images from websites and compile them into a PDF

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages