# yu-ncov-scrape-dxy

> `yu-ncov-scrape-dxy` is a library for scrape ncov-2019 data from https://ncov.dxy.cn/ncovh5/view/pneumonia. 从丁香园中获取ncov-2019国家、省份、城市数据

Latest version **0.2.7** (published 2020-03-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install yu-ncov-scrape-dxy
pnpm add yu-ncov-scrape-dxy
yarn add yu-ncov-scrape-dxy
bun add yu-ncov-scrape-dxy
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.7 |
| Published | 2020-03-17 |
| First published | 2020-02-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 17 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | fastspeeed@gmail.com |
| Maintainers | fastspeeed |
| Keywords | macoolka, ncov, ncov-2019 |

## Links

- npm: https://www.npmjs.com/package/yu-ncov-scrape-dxy
- npm.io page: https://npm.io/package/yu-ncov-scrape-dxy

## Dependencies (6)

- [jest](https://npm.io/package/jest.md) ^25.1.0
- [fp-ts](https://npm.io/package/fp-ts.md) ^2.4.4
- [ts-node](https://npm.io/package/ts-node.md) ^8.6.0
- [scrape-it](https://npm.io/package/scrape-it.md) ^5.2.3
- [macoolka-object](https://npm.io/package/macoolka-object.md) ^0.2.7
- [macoolka-prettier](https://npm.io/package/macoolka-prettier.md) ^0.2.6

## Recent versions

- 0.2.7 (latest) — 2020-03-17
- 0.2.6 — 2020-03-16
- 0.2.5 — 2020-02-13
- 0.2.4 — 2020-02-11
- 0.2.3 — 2020-02-07
- 0.2.2 — 2020-02-07
- 0.2.1 — 2020-02-07
- 0.2.0 — 2020-02-07

## README

# yu-ncov-scrape-dxy

`yu-ncov-scrape-dxy` is a library for scrape ncov-2019 data from https://ncov.dxy.cn/ncovh5/view/pneumonia.
从丁香园中获取ncov-2019国家、省份、城市数据



# Installation (安装)

To install the stable version:

```
npm install yu-ncov-scrape-dxy
```

## Data Struct (数据结构)

```ts
export interface BasicRecord {
  suspectedCount: number,
  confirmedCount: number,
  curedCount: number,
  deadCount: number,
  recordAt: Date
}
export interface CountryRecord extends BasicRecord {
  seriousCount?: number,
  suspectedAddCount?: number,
  confirmedAddCount?: number,
  seriousAddCount?: number,
  curedAddCount?: number,
  deadAddCount?: number,
  country: string,
  continents: string,
}

export interface ProvinceRecord extends BasicRecord {

  country: string,
  province: string
}

export interface CityRecord extends BasicRecord {
  country: string,
  province: string,
  city: string,
}

interface Rumor {
 
  title: string
  subTitle: string
  content: string
  recordAt:Date
}
interface News{
 
  title: string
  subTitle?: string
  content: string
  recordAt:Date
  infoSource:string
  province:string
  sourceUrl:string
}
export interface NCOVRecord {
  countries: CountryRecord[],
  provinces: ProvinceRecord[],
  cities: CityRecord[]
   rumors: Rumor[]
  newses: News[]
}


```

## scrape to NCOVRecord (获取数据)



```ts

import {scrapeToFile} from 'yu-ncov-scrape-dxy'
scrapeToRecord().then((data)=>{

  console.log(data)
})

```

## scrape to file (数据写入文件))


```ts

import {scrapeToFile} from 'yu-ncov-scrape-dxy'

import {join} from 'path'
scrapeToFile(join(process.cwd(), 'ncov.json').then(()=>{
    console.log(`scrape file to ${process.cwd()}/ncov.json over`)
})

```


# License

The MIT License (MIT)

---
_Source: https://npm.io/package/yu-ncov-scrape-dxy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
