Scrape images from a website easily.

npm install image-scraper
10 downloads in the last week
40 downloads in the last month

Node Image Scraper

Scrape images from the web easily.


The image-scrape module provides a class which needs to be constructed with a url:

var Scraper = require("image-scraper");

var scraper = new Scraper("");

The url can be changed easily:

scraper.address = "";

The scraper object provides the .scrape() method. The scrape method accepts one optional argument: a callback function.

This callback function can also be set using the .on() method.

scraper.on("image", function(image){

    // Do something.    

The callback is called every time an image tag has been found, the image object which is passed in consist of the following:

// The attributes found in the image tag, which is parsed by [cheerio](
// The basename of the image.;
// Absolute path to the folder the image will be saved to.
// Extension of the image file.
// The absolute URL of the image.
// The URL of the page the image is scraped from.
// Save the image.;

The default behaviour is to save the image in the current directory, with the name and extension found in the src attribute.

npm loves you