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

aqicn

v0.0.7

Published

An unofficial API to get air quality index from aqicn.org

Downloads

21

Readme

aqicn

Build Status David Dependencies David Dependencies npm npm

一个 aqicn.org 的非官方 API。

安装

npm install aqicn --save

使用

加载模块:

var aqicn = require('aqicn');

获取指定城市的全部 AQI 值:

aqicn.getAQIs('beijing', 'cn', function (err, res) {
  console.log(res);
};

输出:

{
  city: 'beijing',
  time: '2016-01-21T21:00:00+09:00',
  pm25: 212,
  pm10: 95,
  o3: 4,
  no2: 37,
  so2: 14,
  co: 28,
  aqi: 212,
  level: {
    value: 5,
    name: '重度污染',
    implication: '心脏病和肺病患者症状显著加剧,运动耐受力降低,健康人群普遍出现症状',
    statement: '儿童、老年人及心脏病、肺病患者应停留在室内,停止户外运动,一般人群减少户外运动'
  }
}

获取指定城市的某一种 AQI 值:

aqicn.getAQIByName('beijing', 'pm25', function (err, res) {
  console.log(res);
};

输出:

{
  city: 'beijing',
  value: 212,
  time: '2016-01-21T21:00:00-09:00'
}

已知 AQI 等级查询对应的信息:

var lv = 5;
var lang = 'cn';
aqicn.info.level[lv].name[lang];   // AQI 级别名
aqicn.info.level[lv].implication[lang];   // 对健康的影响
aqicn.info.level[lv].statement[lang];   // 建议采取的措施

问题

有没有历史查询功能?

无,但你可以自己抓取。

你怎么能用 HTTP 请求暴力抓取数据?这是不对的!

我方了。

你的代码为什么这样糟糕?

太好了!快快联系我,告诉我到底哪里糟糕!

感谢

aqicn.org 网站 - 提供数据

Node.jsrequestcheerio - 提供技术

GNU Emacs - 提供开发环境

以及其他我所用到的工具、模块的作者们。