GithubHelp home page GithubHelp logo

wikicites's Introduction

wikicites

wikicites is a module that allows you to get a stream of recent citations out of Wikipedia(s) as JSON. Citations are the bedrock of Wikipedia, since editors are interested in verifiability not truth ... and citations are a big part of what makes verification possible.

Install

  1. get nodejs
  2. npm install wikicites

Use

CoffeeScript

WikiCites = require('wikicites').WikiCites

w = new WikiCites(channels: ["#en.wikipedia"])
w.listen (citation) ->
  console.log citation

NodeJS

var WikiCites = require('wikicites').WikiCites;

w = new WikiCites({channels: ["#en.wikipedia"]})
w.listen(function(citation) {
  console.log(citation);
});

Citation Data

In these two examples a callback is receiving a citation as it occurs in an edit on Wikipedia. The citation is a JavaScript object that will look something like:

{
  "type": "news",
  "last": "Crace",
  "first": "John",
  "title": "David Cesarani: The making of a defiant moderate",
  "url": "http://www.guardian.co.uk/education/2004/oct/12/academicexperts.highereducationprofile?INTCMP=SRCH",
  "accessdate": "19 April 2011",
  "newspaper": "The Guardian",
  "date": "12 October 2004",
  "change": {
    "channel": "#en.wikipedia",
    "flag": "",
    "page": "David Cesarani",
    "pageUrl": "http://en.wikipedia.org/wiki/David_Cesarani",
    "url": "http://en.wikipedia.org/w/index.php?diff=567685070&oldid=567623667",
    "delta": 511,
    "comment": "Reverted 1 edit by [[Special:Contributions/Red Stone Arsenal|Red Stone Arsenal]] ([[User talk:Red Stone Arsenal|talk]]): Get consensus for your change, drive by reverts every few months aint that. ([[WP:TW|TW]])",
    "wikipedia": "English Wikipedia",
    "wikipediaUrl": "http://en.wikipedia.org",
    "user": "Nableezy",
    "userUrl": "http://en.wikipedia.org/wiki/User:Nableezy",
    "unpatrolled": false,
    "newPage": false,
    "robot": false,
    "anonymous": false,
    "namespace": "Article"
  }
}

which would represent the following citation wikitext:

{{cite news
  |last=Crace
  |first=John
  |title=David Cesarani: The making of a defiant moderate
  |url=http://www.guardian.co.uk/education/2004/oct/12/academicexperts.highereducationprofile?INTCMP=SRCH
  |accessdate=19 April 2011
  |newspaper=The Guardian
  |date=12 October 2004}}

In addition to the citation information you can see that the JSON object includes information about the change itself, what Wikipedia article the citation appears in, what Wikipedia the article belongs to, who made the edit, etc.

Develop

To hack on wikicites you'll need to clone this repository, install the dependencies, and then run the test suite with mocha:

git checkout https://github.com/edsu/wikicites.git
cd wikicites
npm install
node_modules/.bin/mocha 

If you use mocha with other projects you may want to install it globally which will put it in your system PATH:

npm install -g mocha

Some tests may spuriously fail if they timeout before an edit with a citation occurs on Wikipedia.

Build Status

License

  • CC0

wikicites's People

Contributors

edsu avatar

Watchers

 avatar  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.