GithubHelp home page GithubHelp logo

wiki's Introduction

NPM Version Build Status Coverage Status gitcheese.com

WikiJs is a node.js library which serves as an interface to Wikipedia (or any MediaWiki).

What can it do?

  • Search wiki articles
  • Fetch article content
  • Find all links/images/categories in a article page
  • Get parsed information about articles
  • Find articles by geographical location
  • and much more!

Documentation

https://dijs.github.io/wiki

Install

npm install wikijs

Build yourself

You can run these commands in order to build and test WikiJs:

git clone [email protected]:dijs/wiki.git
cd wiki
npm install
npm run build
npm test

Usage

import wiki from 'wikijs';
// const wiki = require('wikijs').default;

wiki().page('Batman')
	.then(page => page.info('alterEgo'))
	.then(console.log); // Bruce Wayne

Usage with webpack

In order for webpack to build wikijs properly, you must add an option to your webpack configuration file. Documentation

externals: {
  "isomorphic-fetch": "fetch"
}

Usage with other MediaWiki's

You can use the API options configuration:

wiki({
	apiUrl: 'https://awoiaf.westeros.org/api.php',
	origin: null
}).search('Winterfell');

Usage with other languages

You just need to change the API to the proper URL. This is normally just changing the subdomain of wikipedia.

wiki({ apiUrl: 'https://es.wikipedia.org/w/api.php' })
  .page('Cristiano Ronaldo')
  .then(page => page.info())
  .then(console.log);

Read more about Cross Domain Requests here

Parsing Wiki Infobox Data

The code Wikipedia uses for infobox data is strange and complex. So I have split the parsing code into another library. You can find it here. NPM Version

We not only parse out the information, but also try to transform the data into a convenient structure for data processing.

Contribute!

I always welcome help. Please just stick to the lint rules and write tests with each feature/fix.

Artwork

Thanks to Heather van der Dys for the awesome logo!

wiki's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.