{"id":18539033,"url":"https://github.com/simov/wallhaven-client","last_synced_at":"2025-04-09T17:38:04.958Z","repository":{"id":66028277,"uuid":"137492168","full_name":"simov/wallhaven-client","owner":"simov","description":"wallhaven.cc HTTP Client","archived":false,"fork":false,"pushed_at":"2018-12-18T08:59:43.000Z","size":27,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-24T09:47:00.631Z","etag":null,"topics":["client","http","http-client","javascript","js","node","nodejs","wallhaven"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-15T13:40:21.000Z","updated_at":"2022-02-14T01:50:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"2bdf520c-4028-479d-bdaf-96958bb78c98","html_url":"https://github.com/simov/wallhaven-client","commit_stats":{"total_commits":17,"total_committers":1,"mean_commits":17.0,"dds":0.0,"last_synced_commit":"834e7327f8c966c3bb239fcba53ccfcfe8a0dd86"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simov%2Fwallhaven-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simov%2Fwallhaven-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simov%2Fwallhaven-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simov%2Fwallhaven-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simov","download_url":"https://codeload.github.com/simov/wallhaven-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248078589,"owners_count":21044140,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","http","http-client","javascript","js","node","nodejs","wallhaven"],"created_at":"2024-11-06T19:45:55.231Z","updated_at":"2025-04-09T17:38:04.945Z","avatar_url":"https://github.com/simov.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# wallhaven-client\n\n[![npm-version]][npm]\n\n\u003e _[wallhaven.cc] HTTP Client_\n\n# Table of Contents\n\n  - **[API](#api)**\n  - **[Arguments](#arguments)**\n    - [search](#search) / [wallpaper](#wallpaper) / [image](#image) / [login](#login) / [favorites](#favorites)\n  - **[Examples](#examples)**\n\n# API\n\nName      | Arguments     | Returns    | Description\n:---      | :---          | :---       | :---\nsearch    | `{q, categories, purity, resolutions, atleast, ratios, colors, sorting, topRange, order, page, ...options}` | `{Object}`  | Filter wallpapers\nwallpaper | `{id, ...options}`        | `{Object}` | Get full meta data about wallpaper\nimage     | `{id, size, ext, location, ...options}` | writes to file | Download single image\nlogin     | `{user, pass, ...options}` | cookie string | Login to Wallhaven\nfavorites | `{id, page, cookie, ...options}` | `{Object}` | Get meta data about user's collections and the wallpapers in them\n\n```js\nvar wh = require('wallhaven-client')\n\n;(async () =\u003e {\n  var {count, total, pages, tags, wallpapers} = await wh.search({q: 'steampunk'})\n  var meta = await wh.wallpaper({id: '527712'})\n  await wh.image({id: '527712'})\n  var cookie = await wh.login({user, pass})\n  var {collections, wallpapers, pages} = await wh.favorites({cookie})\n})()\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003esearch\u003c/strong\u003e\u003c/summary\u003e\n\n```js\n{\n  count: 24,\n  total: 144,\n  pages: 6,\n  tags: [ { id: '874', name: 'steampunk', purity: 'sfw' } ],\n  wallpapers: [\n    { id: '102569',\n      purity: 'sfw',\n      category: 'general',\n      resolution: '1920x1080',\n      favorites: 243,\n      urls:\n       { page: 'https://alpha.wallhaven.cc/wallpaper/102569',\n         thumb: 'https://alpha.wallhaven.cc/wallpapers/thumb/small/th-102569.jpg',\n         full: 'https://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-102569.jpg',\n         short: 'https://whvn.cc/102569' } },\n    { id: '1182',\n      purity: 'sfw',\n      category: 'general',\n      resolution: '2560x1600',\n      favorites: 123,\n      urls:\n       { page: 'https://alpha.wallhaven.cc/wallpaper/1182',\n         thumb: 'https://alpha.wallhaven.cc/wallpapers/thumb/small/th-1182.jpg',\n         full: 'https://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-1182.jpg',\n         short: 'https://whvn.cc/1182' } }\n  ]\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003ewallpaper\u003c/strong\u003e\u003c/summary\u003e\n\n```js\n{\n  id: '651423',\n  resolution: '2000 x 1285',\n  ratio: undefined,\n  category: 'Anime',\n  purity: 'sfw',\n  size: '5.1 MiB',\n  views: '700',\n  favorites: '6',\n  tags:\n   [ { id: '1', name: 'anime', purity: 'sfw' },\n     { id: '45595', name: 'Macross Delta', purity: 'sfw' },\n     { id: '54814', name: 'Kaname Buccaneer', purity: 'sfw' },\n     { id: '45559', name: 'Mikumo Guynemer', purity: 'sfw' },\n     { id: '74518', name: 'Makina Nakajima', purity: 'sfw' },\n     { id: '49846', name: 'Freyja Wion', purity: 'sfw' },\n     { id: '74689', name: 'Reina Prowler', purity: 'sfw' },\n     { id: '5063', name: 'Macross', purity: 'sfw' } ],\n  colors: [ 'abbcda', 'cccccc', 'ffffff', '66cccc', '999999' ],\n  source: 'https://www.pixiv.net/member_illust.php?mode=medium\u0026amp;illust_id=65239432',\n  uploader:\n   { username: 'AksumkA',\n     avatar: 'https://static.wallhaven.cc/images/user/avatar/32/2_82aff6c49745ac98ef5dda356aabed354de0f398c783ef8e9d4d8b734c283074.png',\n     group: 'owner',\n     profile: 'https://alpha.wallhaven.cc/user/AksumkA' },\n  date: '2018-05-06T21:11:47+00:00',\n  urls:\n   { page: 'https://alpha.wallhaven.cc/wallpaper/651423',\n     thumb: 'https://alpha.wallhaven.cc/wallpapers/thumb/small/th-651423.jpg',\n     full: 'https://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-651423.png',\n     short: 'https://whvn.cc/651423' },\n  ext: 'png'\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003efavorites\u003c/strong\u003e\u003c/summary\u003e\n\n```js\n{\n  collections: [\n    { id: '121373', name: 'Default', private: true, total: 40 },\n    { id: '308194', name: 'Science', public: true, total: 9 } ],\n  wallpapers: [\n    { id: '703709',\n      purity: 'sfw',\n      category: 'general',\n      resolution: '3353x1588',\n      favorites: 129,\n      urls:\n       { page: 'https://alpha.wallhaven.cc/wallpaper/703709',\n         thumb: 'https://alpha.wallhaven.cc/wallpapers/thumb/small/th-703709.jpg',\n         full: 'https://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-703709.jpg',\n         short: 'https://whvn.cc/703709' } }\n  ],\n  pages: 2\n}\n```\n\n\u003c/details\u003e\n\n\n# Arguments\n\n## search\n\nParameter   | Value\n:-          | :-\nq           | any search term, or tag id `id:853`, `@username`, `type:{png/jpg/jpeg}`\ncategories  | see below\npurity      | see below\nresolutions | `1920x1080` or `1920x1080,1920x1200`\natleast     | `1920x1080`\nratios      | `16x9` or `16x9,16x10`\ncolors      | `660000`, `990000`, `cc0000`, `cc3333`, `ea4c88`, `993399`, `663399`, `333399`, `0066cc`, `0099cc`, `66cccc`, `77cc33`, `669900`, `336600`, `666600`, `999900`, `cccc33`, `ffff00`, `ffcc33`, `ff9900`, `ff6600`, `cc6633`, `996633`, `663300`, `000000`, `999999`, `cccccc`, `ffffff`, `424153`\nsorting     | `relevance`, `random`, `date_added`, `views`, `favorites`, `toplist`\ntopRange    | `1d`, `3d`, `1w`, `1M`, `3M`, `6M`, `1y`, only available for `sorting=toplist`\norder       | `desc`, `asc`\npage        | any number\n...options  | `agent, timeout` (any [request-compose][compose-client-options] option)\n\n---\n\nParameter / Value | 000  | 100     | 010     | 001    | 111\n:-                | :-:  | :-:     | :-:     | :-:    | :-:\ncategories        | none | general | anime   | people | all\npurity            | none | sfw     | sketchy | nsfw   | all\n\n\u003e _+ any combination_\n\n---\n\n\u003e Note that currently there is no information on the search page about the actual file extension of the wallpaper. The `urls.full` key will always point to an image with `.jpg` file extension. The [image](#image) download API however will retry to download the image with `.png` file extension if it fails with `.jpg`.\n\n\u003e The search returns up to 24 wallpapers.\n\n---\n\n## wallpaper\n\nParameter  | Value\n:-         | :-\nid         | Wallpaper ID\n...options | `agent, timeout` (any [request-compose][compose-client-options] option)\n\n\n---\n\n## image\n\nParameter  | Value\n:-         | :-\nid         | Wallpaper ID\nsize       | `'thumb'` or `'full'` (defaults to thumb)\next        | `'jpg'` or `'png'` (defaults to jpg)\nlocation   | Download location (defaults to [process.cwd][process-cwd])\n...options | `agent, timeout` (any [request-compose][compose-client-options] option)\n\n---\n\n## login\n\nParameter  | Value\n:-         | :-\nuser       | Username\npass       | Password\n...options | `agent, timeout` (any [request-compose][compose-client-options] option)\n\n---\n\n## favorites\n\nParameter  | Value\n:-         | :-\nid         | Collection ID\npage       | any number\ncookie     | Session cookie\n...options | `agent, timeout` (any [request-compose][compose-client-options] option)\n\n\n# Examples\n\n\u003e [search][example-search] / [wallpaper][example-wallpaper] / [image][example-image] / [favorites][example-favorites]\n\n```bash\nnode examples/search.js [example index]\nnode examples/wallpaper.js [example index]\nnode examples/image.js [example index]\nnode examples/favorites.js [example index]\n```\n\n\n  [npm-version]: https://img.shields.io/npm/v/wallhaven-client.svg?style=flat-square (NPM Package Version)\n  [travis-ci]: https://img.shields.io/travis/simov/wallhaven-client/master.svg?style=flat-square (Build Status - Travis CI)\n  [coveralls-status]: https://img.shields.io/coveralls/simov/wallhaven-client.svg?style=flat-square (Test Coverage - Coveralls)\n  [codecov-status]: https://img.shields.io/codecov/c/github/simov/wallhaven-client.svg?style=flat-square (Test Coverage - Codecov)\n\n  [npm]: https://www.npmjs.com/package/wallhaven-client\n  [travis]: https://travis-ci.org/simov/wallhaven-client\n  [coveralls]: https://coveralls.io/github/simov/wallhaven-client\n  [codecov]: https://codecov.io/github/simov/wallhaven-client?branch=master\n\n  [wallhaven.cc]: https://alpha.wallhaven.cc\n\n  [process-cwd]: https://nodejs.org/dist/latest-v10.x/docs/api/process.html#process_process_cwd\n  [compose-client-options]: https://github.com/simov/request-compose#options\n\n  [example-search]: https://github.com/simov/wallhaven-client/blob/master/examples/search.js\n  [example-wallpaper]: https://github.com/simov/wallhaven-client/blob/master/examples/wallpaper.js\n  [example-image]: https://github.com/simov/wallhaven-client/blob/master/examples/image.js\n  [example-favorites]: https://github.com/simov/wallhaven-client/blob/master/examples/favorites.js\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimov%2Fwallhaven-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimov%2Fwallhaven-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimov%2Fwallhaven-client/lists"}