Giter Club home page Giter Club logo

wikiundump's Introduction

wikiundump saves all Wikipedia pages from a Wikipedia XML dump to individual files.

Usage

Download a Wikipedia dump from https://dumps.wikimedia.org/backup-index.html

$ wikiundump -dir ./simple -keep ,Template simplewiki-*pages-articles-multistream.xml

or:

$ bzcat simplewiki-*.xml.bz2 | wikiundump -dir ./simple -keep ,Template

By default all pages from all namespaces are saved. -keep is used to store only pages from the specified namespaces (comma separated). Note that the main namespace is an empty string, so if you want to keep the main namespace only use wikiundump -keep "," :(

Directory structure

Files are stored with 3 levels of subdirectories, with the namespace as an extra leading subdirectory if there is any. The directory names are the first three letters of the page title, lowercased, with each non ASCII alphanum replaced with _. If the name of the page is shorter than 3 characters it's padded with _s to length 3. The title of the page will have the first letter uppercased, according to the namespace's Case (we support only "first-letter").

e.g.:

Accordion                   -> /a/c/c/Accordion
a cappella                  -> /a/_/c/A cappella
Açaí Palm                   -> /a/_/a/Açaí Palm
-1                          -> /_/1/_/-1
A∴A∴                        -> /a/_/a/A∴A∴
Template:Abbreviations      -> /Template/a/b/b/Template:Abbreviations
Template:AA                 -> /Template/a/a/_/Template:AA
Templater:AA                -> /t/e/m/Templater:AA

The list of namespaces is saved in .../namespaces.json. Later, when finding files, it is needed to know what pages have namespace prefixes and what pages happen to have a ':' in their name. You also need to know the case rules for each namespace.

Redirects

Pages which redirect to another page are symlinked. Use wikiundump -symlink false if that's not wanted (redirected pages will be ignored).

Filesystem

You need a case sensitive filesystem, and it must not choke on Unicode filenames.

wikiundump's People

Stargazers

 avatar

Watchers

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