Skip to content

codigourbano/cep-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CEP Scraper

Build Status Coverage Status bitHound Score Dependency Status

A JavaScript client to scrape data from BuscaCEP.

Lei Postal Art. 15 § 3º

É facultada a edição de lista de endereçamento postal sem finalidade comercial e de distribuição gratuita, conforme disposto em regulamento.

Install

Inside your application directory:

$ npm install cep-scraper --save

Examples

Get address from postcode

Code

var CEP = require('cep-scraper');

CEP.scrape('01310-000', function(res) {
  console.log(res.data);
});

Output

{
  "data": [
    {
      "address": {
        "name": "Avenida Paulista",
        "range": [
          "start",
          "610"
        ],
        "side": "even"
      },
      "district": "Bela Vista",
      "city": "São Paulo",
      "state": "SP",
      "postcode": "01310-000",
      "client": ""
    }
  ]
}

Search using a string

Code

var CEP = require('cep-scraper');

CEP.scrape('avenida paulista 1111', function(res) {
  console.log(res.data);
});

Output

{
  "data": [
    {
      "address": {
        "name": "Avenida Paulista",
        "number": 1111
      },
      "district": "Bela Vista",
      "city": "São Paulo",
      "state": "SP",
      "postcode": "01311-920",
      "client": "Citibank S.A."
    }
  ]
}

Contributing

  1. Clone locally
  2. npm install
  3. Write code
  4. npm test
  5. Pull request.

Mantainers can update coveralls.io with an API key and running ./coveralls.