npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wonderful-bing-wallpaper

v0.3.4

Published

Simple bing daily wallpaper API lib for node.js

Downloads

61

Readme

wonderful-bing-wallpaper

GitHub stars npm GitHub issues GitHub last commit license

NPM

🌅 Simple bing daily wallpaper API lib for Node.js. 极简的 Node.js 版必应壁纸 API 库。

  • 简单:1 个接口
  • 稳定:与 Bing 同在
  • 轻巧:不依赖任何第三方

Credit

stackoverflow - Is there a way to get Bing's photo of the day?

Example

Usage

npm i wonderful-bing-wallpaper --save
const WonderfulBingWallpaper = require('wonderful-bing-wallpaper')

// get support resolutions list
const resolutions = WonderfulBingWallpaper.getResolutions()

// instance
const wbw = new WonderfulBingWallpaper({ /* options */ })

// update default options
wbw.setOptions({ /* options */ })

// get daily wallpapers
wbw.getWallpapers({ /* params */ }).then(wallpaperJSON => {
  console.log('got wallpaperJSON data', wallpaperJSON)
  console.log('got humanizeWallpapers data - Array', wbw.humanizeWallpapers(wallpaperJSON))
  console.log('got humanizeWallpapers data - Object', wbw.humanizeWallpapers(wallpaperJSON[0]))
})

API

new WonderfulBingWallpaper(options?: object): instance

wbw.setOptions(options?: object)

@return WonderfulBingWallpaper instance

recommended option field(推荐设置的字段)

|params|type|required|default|desc| |:----:|:--:|:------:|:-----:|----| |size |Number|false|1| how many images - 几张图片 size <= 8| |day |Number|false|0| how days before - 往前推几天 day <= 7| |format|String|false|js| result data format - 返回数据的格式 js/xml/rss | |local |String|false|en-US| your location - 你想拿到什么语言的版本(国内 zh-CN)|

not recommended option field(非必要情况不要设置的字段)

|params|type|required|default|desc| |:----:|:--:|:------:|:-----:|----| |ensearch|number|false|0| 0 / 1 1 则查询全量数据,包括如图片描述、故事、封面文字...开启后会被强制切换为全英文(实际 bing 拿的美版数据)| |host |String|false|www.bing.com| bing wallpaper api host 你想在哪个服务器拿数据(国内 cn.bing.com)| |wallpaperApi|String|false|/HPImageArchive.aspx| bing wallpaper api path 如果哪天 Bing 改接口了你可以手动设置一下| |resolution|String|false|1920x1200| humanizeWallpapers second param default resolution 使用 humanizeWallpapers 方法时第二参数的默认值|


wbw.getWallpapers(params?: object): array

@return wallpaper array

the same as option fields.


wbw.humanizeWallpapers(wallPapers: object | array, resolution?: string): object | array

@return humanized wallpaper data.

{
  ...wallpaper,
  humanizedCopyrightUrl: string,
  humanizedSearchUrl: string,
  humanizedImageUrl: string,
  humanizedResolutionUrl: string
}

|params|type|required|default|desc| |:----:|:--:|:------:|:-----:|----| |wallPapers|Array/Object|true|null| wallpaper images 图片或多张图片| |resolution|String|false|{instance}.options.resolution| wallpaper resolution 要输出的图片地址里的分辨率|


Dev

yarn
yarn dev
yarn lint
yarn test
yarn build
npm run test

License

MIT