mirror of https://github.com/IoTcat/coron-lstn.git
uk
parent
fbf15f3d01
commit
957fe1fba6
15 changed files with 571 additions and 13 deletions
@ -1,2 +1 @@ |
||||
node_modules/ |
||||
var/ |
||||
|
@ -0,0 +1,21 @@ |
||||
MIT License |
||||
|
||||
Copyright (c) 2020 呓喵酱 |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
SOFTWARE. |
@ -0,0 +1,38 @@ |
||||
# coro-py |
||||
新型冠状病毒 爬虫 丁香医生 |
||||
|
||||
## 快速使用 |
||||
|
||||
### 引入依赖 |
||||
``` |
||||
$ npm i coro-py |
||||
``` |
||||
或者 |
||||
``` |
||||
$ yarn add coro-py |
||||
``` |
||||
|
||||
### 打印所有数据 |
||||
```js |
||||
const coro = require('coro-py'); |
||||
|
||||
(async () => { |
||||
console.log(await coro()); |
||||
})() |
||||
``` |
||||
|
||||
## 参数说明 |
||||
|
||||
``` |
||||
var params = { |
||||
reg: { |
||||
inland: /getAreaStat\s=\s([\s\S]*?)}catch\(e\)/, //匹配中国地区的正则 |
||||
oversea: /getListByCountryTypeService2\s=\s([\s\S]*?)}catch\(e\)/ //匹配海外的正则 |
||||
}, |
||||
url: 'https://ncov.dxy.cn/ncovh5/view/pneumonia' //目标网址,默认丁香园 |
||||
} |
||||
``` |
||||
|
||||
## 开源协议 |
||||
|
||||
本项目使用MIT协议,允许非署名商业及非商业用途。武汉加油!中国加油!! |
@ -0,0 +1,42 @@ |
||||
/* coro-py |
||||
* |
||||
* By iotcat (https://iotcat.me)
|
||||
* MIT Licensed |
||||
*
|
||||
*/ |
||||
module.exports = async (params) => { |
||||
|
||||
var o_params = { |
||||
reg: { |
||||
inland: /getAreaStat\s=\s([\s\S]*?)}catch\(e\)/, |
||||
oversea: /getListByCountryTypeService2\s=\s([\s\S]*?)}catch\(e\)/ |
||||
}, |
||||
url: 'https://ncov.dxy.cn/ncovh5/view/pneumonia' |
||||
} |
||||
|
||||
Object.assign(o_params, params); |
||||
|
||||
var o = []; |
||||
|
||||
const request = require('request'); |
||||
|
||||
|
||||
return new Promise((resolve, reject) => { |
||||
request(o_params.url, (err, res, body) => { |
||||
if(err){ |
||||
reject(err); |
||||
}else{ |
||||
try{ |
||||
o = JSON.parse(body.match(o_params.reg.inland)[1]); |
||||
o.push.apply(o, JSON.parse(body.match(o_params.reg.oversea)[1])); |
||||
resolve(o); |
||||
}catch(e){ |
||||
reject(e); |
||||
} |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
|
||||
|
@ -0,0 +1,346 @@ |
||||
{ |
||||
"name": "coro-py", |
||||
"version": "1.0.0", |
||||
"lockfileVersion": 1, |
||||
"requires": true, |
||||
"dependencies": { |
||||
"ajv": { |
||||
"version": "6.11.0", |
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.11.0.tgz", |
||||
"integrity": "sha512-nCprB/0syFYy9fVYU1ox1l2KN8S9I+tziH8D4zdZuLT3N6RMlGSGt5FSTpAiHB/Whv8Qs1cWHma1aMKZyaHRKA==", |
||||
"requires": { |
||||
"fast-deep-equal": "^3.1.1", |
||||
"fast-json-stable-stringify": "^2.0.0", |
||||
"json-schema-traverse": "^0.4.1", |
||||
"uri-js": "^4.2.2" |
||||
} |
||||
}, |
||||
"asn1": { |
||||
"version": "0.2.4", |
||||
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", |
||||
"integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", |
||||
"requires": { |
||||
"safer-buffer": "~2.1.0" |
||||
} |
||||
}, |
||||
"assert-plus": { |
||||
"version": "1.0.0", |
||||
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", |
||||
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" |
||||
}, |
||||
"asynckit": { |
||||
"version": "0.4.0", |
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", |
||||
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" |
||||
}, |
||||
"aws-sign2": { |
||||
"version": "0.7.0", |
||||
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", |
||||
"integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" |
||||
}, |
||||
"aws4": { |
||||
"version": "1.9.1", |
||||
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", |
||||
"integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==" |
||||
}, |
||||
"bcrypt-pbkdf": { |
||||
"version": "1.0.2", |
||||
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", |
||||
"integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", |
||||
"requires": { |
||||
"tweetnacl": "^0.14.3" |
||||
} |
||||
}, |
||||
"caseless": { |
||||
"version": "0.12.0", |
||||
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", |
||||
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" |
||||
}, |
||||
"combined-stream": { |
||||
"version": "1.0.8", |
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", |
||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", |
||||
"requires": { |
||||
"delayed-stream": "~1.0.0" |
||||
} |
||||
}, |
||||
"core-util-is": { |
||||
"version": "1.0.2", |
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", |
||||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" |
||||
}, |
||||
"dashdash": { |
||||
"version": "1.14.1", |
||||
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", |
||||
"integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", |
||||
"requires": { |
||||
"assert-plus": "^1.0.0" |
||||
} |
||||
}, |
||||
"delayed-stream": { |
||||
"version": "1.0.0", |
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", |
||||
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" |
||||
}, |
||||
"ecc-jsbn": { |
||||
"version": "0.1.2", |
||||
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", |
||||
"integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", |
||||
"requires": { |
||||
"jsbn": "~0.1.0", |
||||
"safer-buffer": "^2.1.0" |
||||
} |
||||
}, |
||||
"extend": { |
||||
"version": "3.0.2", |
||||
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", |
||||
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" |
||||
}, |
||||
"extsprintf": { |
||||
"version": "1.3.0", |
||||
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", |
||||
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" |
||||
}, |
||||
"fast-deep-equal": { |
||||
"version": "3.1.1", |
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", |
||||
"integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==" |
||||
}, |
||||
"fast-json-stable-stringify": { |
||||
"version": "2.1.0", |
||||
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", |
||||
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" |
||||
}, |
||||
"forever-agent": { |
||||
"version": "0.6.1", |
||||
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", |
||||
"integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" |
||||
}, |
||||
"form-data": { |
||||
"version": "2.3.3", |
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", |
||||
"integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", |
||||
"requires": { |
||||
"asynckit": "^0.4.0", |
||||
"combined-stream": "^1.0.6", |
||||
"mime-types": "^2.1.12" |
||||
} |
||||
}, |
||||
"getpass": { |
||||
"version": "0.1.7", |
||||
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", |
||||
"integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", |
||||
"requires": { |
||||
"assert-plus": "^1.0.0" |
||||
} |
||||
}, |
||||
"har-schema": { |
||||
"version": "2.0.0", |
||||
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", |
||||
"integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" |
||||
}, |
||||
"har-validator": { |
||||
"version": "5.1.3", |
||||
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", |
||||
"integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", |
||||
"requires": { |
||||
"ajv": "^6.5.5", |
||||
"har-schema": "^2.0.0" |
||||
} |
||||
}, |
||||
"http-signature": { |
||||
"version": "1.2.0", |
||||
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", |
||||
"integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", |
||||
"requires": { |
||||
"assert-plus": "^1.0.0", |
||||
"jsprim": "^1.2.2", |
||||
"sshpk": "^1.7.0" |
||||
} |
||||
}, |
||||
"is-typedarray": { |
||||
"version": "1.0.0", |
||||
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", |
||||
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" |
||||
}, |
||||
"isstream": { |
||||
"version": "0.1.2", |
||||
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", |
||||
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" |
||||
}, |
||||
"jsbn": { |
||||
"version": "0.1.1", |
||||
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", |
||||
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" |
||||
}, |
||||
"json-schema": { |
||||
"version": "0.2.3", |
||||
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", |
||||
"integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" |
||||
}, |
||||
"json-schema-traverse": { |
||||
"version": "0.4.1", |
||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", |
||||
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" |
||||
}, |
||||
"json-stringify-safe": { |
||||
"version": "5.0.1", |
||||
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", |
||||
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" |
||||
}, |
||||
"jsprim": { |
||||
"version": "1.4.1", |
||||
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", |
||||
"integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", |
||||
"requires": { |
||||
"assert-plus": "1.0.0", |
||||
"extsprintf": "1.3.0", |
||||
"json-schema": "0.2.3", |
||||
"verror": "1.10.0" |
||||
} |
||||
}, |
||||
"mime-db": { |
||||
"version": "1.43.0", |
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", |
||||
"integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==" |
||||
}, |
||||
"mime-types": { |
||||
"version": "2.1.26", |
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", |
||||
"integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", |
||||
"requires": { |
||||
"mime-db": "1.43.0" |
||||
} |
||||
}, |
||||
"oauth-sign": { |
||||
"version": "0.9.0", |
||||
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", |
||||
"integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" |
||||
}, |
||||
"performance-now": { |
||||
"version": "2.1.0", |
||||
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", |
||||
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" |
||||
}, |
||||
"psl": { |
||||
"version": "1.7.0", |
||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.7.0.tgz", |
||||
"integrity": "sha512-5NsSEDv8zY70ScRnOTn7bK7eanl2MvFrOrS/R6x+dBt5g1ghnj9Zv90kO8GwT8gxcu2ANyFprnFYB85IogIJOQ==" |
||||
}, |
||||
"punycode": { |
||||
"version": "2.1.1", |
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", |
||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" |
||||
}, |
||||
"qs": { |
||||
"version": "6.5.2", |
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", |
||||
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" |
||||
}, |
||||
"request": { |
||||
"version": "2.88.0", |
||||
"resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", |
||||
"integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", |
||||
"requires": { |
||||
"aws-sign2": "~0.7.0", |
||||
"aws4": "^1.8.0", |
||||
"caseless": "~0.12.0", |
||||
"combined-stream": "~1.0.6", |
||||
"extend": "~3.0.2", |
||||
"forever-agent": "~0.6.1", |
||||
"form-data": "~2.3.2", |
||||
"har-validator": "~5.1.0", |
||||
"http-signature": "~1.2.0", |
||||
"is-typedarray": "~1.0.0", |
||||
"isstream": "~0.1.2", |
||||
"json-stringify-safe": "~5.0.1", |
||||
"mime-types": "~2.1.19", |
||||
"oauth-sign": "~0.9.0", |
||||
"performance-now": "^2.1.0", |
||||
"qs": "~6.5.2", |
||||
"safe-buffer": "^5.1.2", |
||||
"tough-cookie": "~2.4.3", |
||||
"tunnel-agent": "^0.6.0", |
||||
"uuid": "^3.3.2" |
||||
} |
||||
}, |
||||
"safe-buffer": { |
||||
"version": "5.2.0", |
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", |
||||
"integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" |
||||
}, |
||||
"safer-buffer": { |
||||
"version": "2.1.2", |
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", |
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" |
||||
}, |
||||
"sshpk": { |
||||
"version": "1.16.1", |
||||
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", |
||||
"integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", |
||||
"requires": { |
||||
"asn1": "~0.2.3", |
||||
"assert-plus": "^1.0.0", |
||||
"bcrypt-pbkdf": "^1.0.0", |
||||
"dashdash": "^1.12.0", |
||||
"ecc-jsbn": "~0.1.1", |
||||
"getpass": "^0.1.1", |
||||
"jsbn": "~0.1.0", |
||||
"safer-buffer": "^2.0.2", |
||||
"tweetnacl": "~0.14.0" |
||||
} |
||||
}, |
||||
"tough-cookie": { |
||||
"version": "2.4.3", |
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", |
||||
"integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", |
||||
"requires": { |
||||
"psl": "^1.1.24", |
||||
"punycode": "^1.4.1" |
||||
}, |
||||
"dependencies": { |
||||
"punycode": { |
||||
"version": "1.4.1", |
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", |
||||
"integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" |
||||
} |
||||
} |
||||
}, |
||||
"tunnel-agent": { |
||||
"version": "0.6.0", |
||||
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", |
||||
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", |
||||
"requires": { |
||||
"safe-buffer": "^5.0.1" |
||||
} |
||||
}, |
||||
"tweetnacl": { |
||||
"version": "0.14.5", |
||||
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", |
||||
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" |
||||
}, |
||||
"uri-js": { |
||||
"version": "4.2.2", |
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", |
||||
"integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", |
||||
"requires": { |
||||
"punycode": "^2.1.0" |
||||
} |
||||
}, |
||||
"uuid": { |
||||
"version": "3.4.0", |
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", |
||||
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" |
||||
}, |
||||
"verror": { |
||||
"version": "1.10.0", |
||||
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", |
||||
"integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", |
||||
"requires": { |
||||
"assert-plus": "^1.0.0", |
||||
"core-util-is": "1.0.2", |
||||
"extsprintf": "^1.2.0" |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,53 @@ |
||||
{ |
||||
"_from": "coro-py", |
||||
"_id": "coro-py@1.1.1", |
||||
"_inBundle": false, |
||||
"_integrity": "sha512-AjgHR7fX39HCXxUODB9IDXie5gijywHoSnO6WSJTnwXBoTlh/k2dHh0KhJ0FJVsvzzZYreNi/NzggofYaDOFGg==", |
||||
"_location": "/coro-py", |
||||
"_phantomChildren": {}, |
||||
"_requested": { |
||||
"type": "tag", |
||||
"registry": true, |
||||
"raw": "coro-py", |
||||
"name": "coro-py", |
||||
"escapedName": "coro-py", |
||||
"rawSpec": "", |
||||
"saveSpec": null, |
||||
"fetchSpec": "latest" |
||||
}, |
||||
"_requiredBy": [ |
||||
"#USER", |
||||
"/" |
||||
], |
||||
"_resolved": "https://registry.npmjs.org/coro-py/-/coro-py-1.1.1.tgz", |
||||
"_shasum": "e7faa34bf5a319bdafff368478490dd65b110278", |
||||
"_spec": "coro-py", |
||||
"_where": "/home/yimian/opt/coron-lstn-uk", |
||||
"author": { |
||||
"name": "iotcat" |
||||
}, |
||||
"bugs": { |
||||
"url": "https://github.com/iotcat/coro-py/issues" |
||||
}, |
||||
"bundleDependencies": false, |
||||
"dependencies": { |
||||
"request": "^2.88.0" |
||||
}, |
||||
"deprecated": false, |
||||
"description": "新型冠状病毒爬虫", |
||||
"homepage": "https://github.com/iotcat/coro-py#readme", |
||||
"keywords": [ |
||||
"coronavirus" |
||||
], |
||||
"license": "MIT", |
||||
"main": "index.js", |
||||
"name": "coro-py", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git+https://github.com/iotcat/coro-py.git" |
||||
}, |
||||
"scripts": { |
||||
"test": "test.js" |
||||
}, |
||||
"version": "1.1.1" |
||||
} |
@ -0,0 +1,5 @@ |
||||
const coro = require('./uk.js'); |
||||
|
||||
(async () => { |
||||
console.log(await coro()); |
||||
})() |
@ -0,0 +1,5 @@ |
||||
const coro = require('./index.js'); |
||||
|
||||
(async () => { |
||||
console.log(await coro()); |
||||
})() |
@ -0,0 +1,38 @@ |
||||
/* coro-py-uk |
||||
* |
||||
* By iotcat (https://iotcat.me)
|
||||
* MIT Licensed |
||||
*
|
||||
*/ |
||||
module.exports = async (params) => { |
||||
|
||||
var o_params = { |
||||
reg: /negative[\W\s]*(\d+)[\s\S]*positive/i,///negative([\s\S]*)positive/,///negative\sand\s(\S*)\spositive/,
|
||||
url: 'https://www.gov.uk/guidance/coronavirus-covid-19-information-for-the-public#number-of-cases' |
||||
} |
||||
|
||||
Object.assign(o_params, params); |
||||
|
||||
var o = []; |
||||
|
||||
const request = require('request'); |
||||
|
||||
|
||||
return new Promise((resolve, reject) => { |
||||
request(o_params.url, (err, res, body) => { |
||||
if(err){ |
||||
reject(err); |
||||
}else{ |
||||
try{ |
||||
o = body.match(o_params.reg)[1]; |
||||
resolve(o); |
||||
}catch(e){ |
||||
reject(e); |
||||
} |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
|
||||
|
@ -1,8 +1,9 @@ |
||||
const coro = require('./index.js'); |
||||
|
||||
var uk = coro({ |
||||
province: '英国',
|
||||
sms: ['18118155257', '15827586269'], |
||||
mail: ['i@yimian.xyz', 'hao.zheng17@student.xjtlu.edu.cn', "mingranjia@163.com"] |
||||
province: 'uk', |
||||
//debug: true,
|
||||
//sms: ['18118155257', '15827586269'],
|
||||
mail: ['i@yimian.xyz', 'hao.zheng17@student.xjtlu.edu.cn']//, "mingranjia@163.com"]
|
||||
}); |
||||
|
||||
|
Loading…
Reference in new issue