0x333333 / wiki-infobox-parser

A Wikipedia Infobox Parser
https://www.npmjs.com/package/wiki-infobox-parser
MIT License
19 stars 5 forks source link

Wikipedia Infobox Parser

build status npm version

A parser for Wikipedia Inforbox, as described in Wikipedia help page:

An infobox is a fixed-format table designed to be added to the top right-hand corner of articles to consistently present a summary of some unifying aspect that the articles share and sometimes to improve navigation to other interrelated articles.

<img src="https://nodei.co/npm/wiki-infobox-parser.png?downloads=true&downloadRank=true" alt="alt nodejs_infobox_screenshot" width="300" height="60">

<img src="https://nodei.co/npm-dl/wiki-infobox-parser.png" alt="alt nodejs_infobox_screenshot" width="350" height="40.6">

Features

It's still on development, it needs to support more markup templates.

Installation

npm install wiki-infobox-parser

Usage

var wikiParser = require('wiki-infobox-parser');

wikiParser('france', function(err, result) {
  if (err) {
        console.error(err.message);
    } else {
        console.log(result);
    }
});

Result

<img src="http://7sbqda.com1.z0.glb.clouddn.com/Screen%20Shot%202015-10-20%20at%2000.11.13.png" alt="alt nodejs_infobox_screenshot" width="240" height="400">

The parsed result is

{
    "name": "Node.js",
    "logo": "frameless",
    "author": "Ryan Dahl",
    "developer": "[https://github.com/ry/node/blob/master/AUTHORS Node.js Developers], Joyent, [https://github.com/joyent/node/graphs/contributors GitHub Contributors]",
    "operating system": "OS X, Linux, Solaris, FreeBSD, OpenBSD, Microsoft Windows (older versions require Cygwin), webOS, NonStop OS",
    "status": "Active",
    "released": "2009/05/27",
    "latest release version": "4.2.1",
    "latest release date": "2015/10/13",
    "programming language": "C, C++, JavaScript",
    "genre": "Event-driven networking",
    "license": "MIT",
    "website": "http://nodejs.org"
}

How to contribute

Todo

Issue tracker

img

Don't hesitate to contact me when you have any issue or idea about this parser, both PivotalTracker and Github issue are welcomed!

Tests

# Test with a small test cases set
make test

# Test with a full test cases set
# It will take ~2mins, depending on the network
make test-all

Before sending a PR please add corresponding tests, thanks!

Contributors

Reference