@grodno-city/grodno-gov-renting-scraper
v1.0.1
Published
Scrap premises rented by Grodno government
Downloads
9
Readme
Scrap premises rented by Grodno government
Scraper make requests to http://grodno.gov.by/ru/main.aspx?guid=7101
Install
yarn add @grodno-city/grodno-gov-renting-scraper
or
npm install --save @grodno-city/grodno-gov-renting-scraper
Usage
const { extract } = require('@grodno-city/grodno-gov-renting-scraper')
const run = async () => {
const result = await extract()
console.log(result)
}
run()
Provided result has "premises by organization" format, so it will something like:
[
{
name: 'Унитарное жилищное ремонтно-эксплуатационное предприятие Ленинского района',
premises: [
...
{
address: 'ул. Академическая, 14',
description: 'Нежилое изолированное помещение, на 1,2 этаже здания.',
areas: '50,82; 39.0; 34.86;30.1; 14.4',
appointment: 'офис, оказание услуг',
contact: '43-04-47'
}
...
]
}
]
Enhancers
Enhancers can transform specific fields to machine-readable format
areaEnhancer
Transfrom areas
field to array of numbers or objects
const { extract, enhancers } = require('@grodno-city/grodno-gov-renting-scraper')
const { areaEnhancer } = enhancers
const run = async () => {
const result = await extract()
result.forEach(organization => {
organization.premises.forEach(premise => {
const enhancedAddress = areaEnhancer(premise.areas)
console.log(enhancedAddress)
})
})
}
run()
Areas array can contains a numbers or an objects:
areas: [12, 50, {
apartmentNumber: '24',
area: '44.4'
}]
Api
- extract() - request and parse data
- parse(rawText: String) - parse passed string
- requestRawData() - request and return string
License
Under MIT license