Skip to content

Negaihoshi/SEO_Parser

Repository files navigation

simple seo parser Build Status

Require

  • node v10+

Because package is build in native async/await

Installation

npm install simple-seo-parser

Document

Require package

const Parser = require("simple-seo-parser");
You need choose one input function and one output fucntion.
  Input:
    fromFile
    fromReadStream
  Output:
    outputToFile
    outputToStream
    outputToConsole
    outputToResult

Read from file, Write from file

new Parser.SEOParser().fromFile("./example/example-pass.html").outputToFile();

Read from stream, Write from stream

new Parser.SEOParser()
  .fromReadStream("./example/example-pass.html")
  .outputToStream("./seo-parse-result.json");

Read from stream, show from console

new Parser.SEOParser()
  .fromReadStream("./example/example-pass.html")
  .outputToConsole();

Read from stream, return result

new Parser.SEOParser()
  .fromReadStream("./example/example-pass.html")
  .outputToResult();

Add custom rule

new Parser.SEOParser({
  rules: [
    {
      tag: {
        include: "h2"
      },
      condition: {
        "=": 0
      }
    }
  ]
})
  .fromReadStream("./example/example-pass.html")
  .outputToResult();

Disable default rule

new Parser.SEOParser({
  rules: [
    {
      tag: {
        include: "h2"
      },
      condition: {
        "=": 0
      }
    }
  ],
  default: false
})
  .fromReadStream("./example/example-pass.html")
  .outputToResult();