Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/louiscklaw/2019-district-council-election-parser
2019-district-council-election-parser
https://github.com/louiscklaw/2019-district-council-election-parser
election hong-kong javscript parser puppeteer x-ray
Last synced: about 1 month ago
JSON representation
2019-district-council-election-parser
- Host: GitHub
- URL: https://github.com/louiscklaw/2019-district-council-election-parser
- Owner: louiscklaw
- Created: 2019-10-29T12:28:40.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-12T16:46:09.000Z (almost 3 years ago)
- Last Synced: 2024-10-24T23:34:14.940Z (3 months ago)
- Topics: election, hong-kong, javscript, parser, puppeteer, x-ray
- Language: HTML
- Size: 489 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 2019-district-council-election-parser
A 2019 district council election constituency parser## Installation
Install via NPM:```bash
npm install 2019-district-council-election-parser```
## Usage
#### javascript
```javascript
var try_parser = require("2019-district-council-election-parser");
// simple sanity helloworld
try_parser.helloworld()// parse the list of 2019 election in gov page
try_parser.parse_whole_hongkong_list(`https://www.elections.gov.hk/dc2019/chi/nominat2.html`)```
### output format
```
# In general, it provides format like this, corresponding to the pages structure
{ '香港島': {
'中西區': [array],
'灣仔區': [array],
...
},
'九龍': {
'油尖旺區': [array],
'深水埗區': [array],
...
'九龍城區': [array],
},
'新界': {
'離島區': [array]
...
}
}# In detail, the rows and columns were parsed into format:
{
constituency_code: [ 'A15', 'A15' ],
constituency: [ 'eng constituency', '中文選區' ],
name_of_nominees: [ 'Name of Nominees', '獲提名人士' ],
alias: [ ' ', ' ' ],
gender: [ 'Gender', '性別' ],
occupation: ... ,
political_affiliation: ... ,
date_of_nomination: ... ,
remarks: ...
},```
### test
Test should work as-long-as the web site alive, a frozen html can be found under directory test/frozen
```javascript$ npm run test
```
## License
This project is licensed under the terms of the
[MIT license](/LICENSE).