mei-iirose / wallhaven

API for alpha.wallhaven.cc

Home Page:https://wallhaven.now.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wallhaven

NPM version NPM downloads CircleCI codecov donate

Install

yarn add wallhaven

Usage

const Wallhaven = require('wallhaven')

const api = new Wallhaven()

api.search('attack on titans')
  .then(result => {
    console.log(result)
    // => { totalPages: 29, images: [] }
  })

Micro-service

A micro-service based on this module: https://wallhaven.now.sh

Examples:

API

api.search(keyword, [options])

Search wallpapers by given keyword.

options.categories

Type: Array
Default: ['general', 'anime', 'people']

options.page

Type: Number
Default: 1

options.sorting

Type: string
Default: relevance
Value: one of relevance random date_added views favorites

options.nsfw

Type: boolean
Default: false

Show NSFW (not safe for work) result.

options.sketchy

Type: boolean
Default: false

Show sketchy wallpapers only.

api.details(id)

Get the details of a wallpaper by image id.

id

Type: Number

Image ID.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

wallhaven © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).

egoist.moe · GitHub @egoist · Twitter @_egoistlily

About

API for alpha.wallhaven.cc

https://wallhaven.now.sh

License:MIT License


Languages

Language:JavaScript 100.0%