0.1.1 • Published 8 years ago

wallhaven v0.1.1

Weekly downloads
1
License
MIT
Repository
bitbucket
Last release
8 years ago

wallhaven

A library for searching Wallhaven.

Install

npm install wallhaven

Global Install

npm install -g wallhaven

If you install globally, you can use wallhaven CLI tool.

Usage

var wallhaven = require('wallhaven');

var myOptions = {
  term: '',
  categories: {
    general: true,
    anime: true,
    people: true
  },
  purity: {
    sfw: true,
    sketchy: false,
    nsfw: false
  },
  resolutions: [],
  sorting: 'random',
  page: 1
};

wallhaven(myOptions)
  .then(function (wallpapers) {
    console.log(wallpapers[0]); // show first wallpaper

    /*
      wallpapers[0] = {
        id: 123,
        resolution: "1024x768",
        favorites: 10,
        pageUrl: "https://alpha.wallhaven.cc/wallpaper/123",
        thumbnailUrl: "https://alpha.wallhaven.cc/wallpapers/thumb/small/th-123.jpg",
        imageUrl: "https://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-123.jpg"
      }
    */
  });

CLI usage

Find wallhaven CLI tool path:

npm bin wallhaven

Set a random wallpaper:

wallhaven search ""sky"" -c=general -p=sfw -r=1920x1080+ -s=random -i=1 --set

Get search results as URLs:

wallhaven search ""sky"" --all
0.1.1

8 years ago

0.1.0

8 years ago