博客
关于我
通过脚本获取数据 新型冠状病毒 2019-nCoV 的相关数据。
阅读量:161 次
发布时间:2019-02-28

本文共 3388 字,大约阅读时间需要 11 分钟。

数据来源

(以下数据仅供参考)

脚本文件:app.js

                const express = require('express');                const request = require('request');                const axios = require('axios');                const fs = require('fs');                const app = express();                const url = 'https://3g.dxy.cn/newh5/view/pneumonia';                                const getStatisticsService = (data) => {                    const statisticObj = JSON.parse(data.match(/window.getStatisticsService = (.*?)}catch/)[1]);                    fs.writeFileSync('./data/statistic.json', JSON.stringify(statisticObj, null, 2), (err) => {                        console.log('写入成功');                    });                };                                const getAreaStat = (data) => {                    const areaObj = JSON.parse(data.match(/window.getAreaStat = (.*?)}catch/)[1]);                    fs.writeFileSync('./data/province.json', JSON.stringify(areaObj, null, 2), (err) => {                        console.log('写入成功');                    });                };                                axios.request(url).then(({ data: html }) => {                    getStatisticsService(html);                    getAreaStat(html);                });                                app.listen(3000, () => {                    console.log('app listening port is 3000');                });            

statistic.json文件:

                {                    "id": 1,                    "createTime": 1579537899000,                    "modifyTime": 1580140453000,                    "infectSource": "野生动物,可能为中华菊头蝠",                    "passWay": "未完全掌握,存在人传人、医务人员感染、一定范围社区传播",                    "imgUrl": "https://img1.dxycdn.com/2020/0123/733/3392575782185696736-73.jpg",                    "dailyPic": "https://img1.dxycdn.com/2020/0127/350/3393218957833514634-73.jpg",                    "summary": "",                    "deleted": false,                    "countRemark": "",                    "confirmedCount": 2857,                    "suspectedCount": 5794,                    "curedCount": 56,                    "deadCount": 82,                    "virus": "新型冠状病毒 2019-nCoV",                    "remark1": "易感人群: 暂时不明,病毒存在变异可能",                    "remark2": "潜伏期: 1~14 天均有,平均 10 天,潜伏期内存在传染性",                    "remark3": "",                    "remark4": "",                    "remark5": "",                    "generalRemark": "疑似病例数来自国家卫健委数据,目前为全国数据,未分省市自治区等",                    "abroadRemark": ""                }            

province.json文件:

                {                    "provinceName": "湖北省",                    "provinceShortName": "湖北",                    "confirmedCount": 1423,                    "suspectedCount": 0,                    "curedCount": 45,                    "deadCount": 76,                    "comment": "",                    "cities": [                        {                            "cityName": "武汉",                            "confirmedCount": 698,                            "suspectedCount": 0,                            "curedCount": 42,                            "deadCount": 63                        }                    ]                }            

转载地址:http://ilfj.baihongyu.com/

你可能感兴趣的文章
Python十进制&;包提供错误的结果
查看>>
Python化身“安全老中医”:一键搞定工控系统漏洞,从零基础到精通,收藏这篇就够了!
查看>>
Python加速运行技巧
查看>>
python办公自动化基础遍历文件夹
查看>>
python办公自动化基础输出文件和文件夹
查看>>
python办公自动化基础搜索文件
查看>>
python知识:@classmethod和@staticmethod的异同
查看>>
python前端之css
查看>>
Python制作进度条,原来有这么多方法
查看>>
Python制作简单的学生成绩管理系统
查看>>
python制作甘特图的基本知识(附Demo)
查看>>
python制作一个简单的服务器,【Python】 做一个简单的 http 服务器
查看>>
Python到底能做什么?它的优点在哪?
查看>>
python利用pytorch库导出图像分割算子
查看>>
python利用pyshark监听网卡来抓包其中pyshark中摸索的一些可用参数
查看>>
python利用excel分析过杀漏失
查看>>
python判断汉字数目
查看>>
python判断文件是空的,如果是空的,就删除
查看>>
python判断密码是否正确_python密码判断是否符合要求的方法
查看>>
python判断字符串包含中文_Python 判断字符串是否包含中文
查看>>