暗无天日

=============>DarkSun的个人博客

从命令行追踪新冠肺炎全球疫情数据

今天发现一个好牛逼的网站,可以让我们通过命令行查看新冠肺炎全球疫情数据

  1. 查看指定国家的今日疫情数据

通过访问 `https://corona-stats.online/国家名称` 可以获得指定国家的今日疫情数据,例如下面命令查看中国的当前疫情数据:

curl https://corona-stats.online/china

corona19-01.png

  1. 获取新冠肺炎全球TOP排行榜数据

通过访问 `https://corona-stats.online?top=N` 可以获得感染人数前N的国家今日疫情数据,例如下面命令查看感染人数前5的国家及其疫情数据:

curl https://corona-stats.online?top=5

corona19-02.png

  1. 指定返回 JSON 格式的数据

通过在访问URL后加上 ?format=json 可以获取 JSON 格式的数据,例如下面命令获取中国今日新冠感染人数的JSON数据集:

curl "https://corona-stats.online/china?format=json" |jq

输出结果为

{
  "data": [
    {
      "updated": 1628329931927,
      "country": "China",
      "countryInfo": {
        "_id": 156,
        "iso2": "CN",
        "iso3": "CHN",
        "lat": 35,
        "long": 105,
        "flag": "https://disease.sh/assets/img/flags/cn.png"
      },
      "cases": 93605,
      "todayCases": 107,
      "deaths": 4636,
      "todayDeaths": 0,
      "recovered": 87525,
      "todayRecovered": 33,
      "active": 1444,
      "critical": 39,
      "casesPerOneMillion": 65,
      "deathsPerOneMillion": 3,
      "tests": 160000000,
      "testsPerOneMillion": 111163,
      "population": 1439323776,
      "continent": "Asia",
      "oneCasePerPeople": 15377,
      "oneDeathPerPeople": 310467,
      "oneTestPerPeople": 9,
      "activePerOneMillion": 1,
      "recoveredPerOneMillion": 60.81,
      "criticalPerOneMillion": 0.03,
      "confirmed": 93605,
      "countryCode": "CN"
    }
  ],
  "worldStats": {
    "country": "World",
    "countryCode": "World",
    "cases": 202490517,
    "todayCases": 130727,
    "deaths": 4292020,
    "todayDeaths": 2305,
    "recovered": 180258478,
    "active": 17940019,
    "critical": 95654,
    "casesPerOneMillion": "25980.31",
    "confirmed": 202490517
  }
}