0.0.2 • Published 8 years ago

qqmber v0.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

qqmber — is a simple web page parser

Installation

qqmber requires Node.js to run.

$ npm install qqmber --save

Initialization

var options = {
   urls: [], //urls to parse String - Array
   urlsSchema: [], // - Array of Object
   pageSchema: {}, // - Object
   depth: 1, // default: 1 - Boolean
             // depth shows how organized web page
             // if the first cycle of web page had one passage structure, the next - another
             // It is taken into account in this option & in the previous
   pageEncoding: '' // default: utf8 - String

  }

Example

var qq = require('qqmber')

var opt = {
  urls: [
    "http://www.interfax.ru/russia/",
    "http://www.interfax.ru/world/",
    "http://www.interfax.ru/business/",
    "http://www.interfax.ru/sport/"
  ],
  urlsSchema: [
    //depth 1
    {
      list: '.dNewsCont.topPage.topNewRule .dNewsOne .text div',
      url: 'a'
    }
    // next depth
  ],
  pageSchema: {
    title: '.tMC_head > h1',
    content: '.at > p'
  },
  depth: 1,
  pageEncoding: 'win1251'
}

qq.init(opt)
qq.start( (err, res) => {
  console.log(res);
})

Run

$ npm start