Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a script "GetCovid19Statistics" #1355

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions JavaScript/Get_Covid19_Statistics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Script to retrieve COVID-19 stats using country name
## Description
The script provides live Covid-19 statistics of a country by using "covid19-stats", an NPM module to retrieve worldometer's live Covid-19 stats. The module uses web scraping to obtain real time access to world wide statistical information. Using this script, you can provide the country name as input and get a JsonArray containing latest statistics of the desired country (as listed in worldometers) such as: country, totalCases, newCases, totalDeaths and newDeaths.

## Inputs

**country *Text***

Country name as text input.


## Outputs

**covid19StatsReport *JsonArray***

Covid-19 statistics report as per the country provided as input.

# Usage

- Clone the folder.
- Open command line and change the directory to your folder by using `cd foldername`
- Run the command `npm intall` to import all required modules.
- If you still face module import error, try using `npm install package-name` to install missing modules.
- Then, run the script by using the command `node index.js`.

This script is meant for educational purposes only.

# Demo
[![160258324-d09bb350-6cc5-4f41-bead-6e9dbf5373f5.png](https://i.postimg.cc/VLRdw0f6/160258324-d09bb350-6cc5-4f41-bead-6e9dbf5373f5.png)](https://postimg.cc/crvsMH8y)
10 changes: 10 additions & 0 deletions JavaScript/Get_Covid19_Statistics/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const covid19 = require('covid19-stats');
const prompt = require('prompt-sync')();
async function main() {
const country = prompt('Enter the name of the country you need Covid statistics of: ');
console.log("Details: ");
let stats = await covid19.getCountry(country);
console.log(stats);
}
module.exports.main = main
main();
Loading