November Perfect Moustache
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    image-crawlerpublic

    get-image-urls

    Scrape image urls from a HTML website.

    It's using PhantomJS in the background to get all images including CSS backgrounds.

    Installation

    npm install get-image-urls
    

    Usage

    Import

    var getImageUrls = require('get-image-urls');

    API

    getImageUrls(url, [callback]) //returns Promise

    Result JSON

    [
        { contentType: 'image/png', url: 'http://example.com/bg.png' },
        { contentType: 'image/jpeg', url: 'http://example.com/picture.jpg' }
    ]

    Example

    With NodeJS callback

    var getImageUrls = require('get-image-urls');
     
    getImageUrls('http://google.com', function(err, images) {
      if (!err) {
        console.log('Images found', images.length);
        console.log(images);
      }
      else {
        console.log('ERROR', err);
      }
    })

    With returned Promise

    var getImageUrls = require('get-image-urls');
     
    getImageUrls('http://google.com')
    .then(function(images) {
      console.log('Images found', images.length);
      console.log(images);
    })
    .catch(function(e) {
      console.log('ERROR', e);
    })

    install

    npm i image-crawler

    Downloadsweekly downloads

    3

    version

    1.0.1

    license

    MIT

    homepage

    github.com

    repository

    githubgithub

    last publish

    collaborators

    • avatar