npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

build-wikipedia-feed

v0.1.2

Published

Build a hyperdb of Wikipedia articles.

Downloads

6

Readme

build-wikipedia-feed

Build a hyperdb feed of Wikipedia articles, including historical revisions.

npm version build status ISC-licensed chat on gitter support me on Patreon

Rationale

Problem

Wikipedia is an incredibly important collection of knowledge on the internet. It is free to read and edit for everyone. Though, it is important to know that it is stored on only a handful of servers in a handful of countries controlled by a single organisation. This mainly causes two problems:

  • Currently, it is too easy to censor the Wikipedia. We need a system that supports redundancy without any additional effort.
  • It does not work offline. Making an offline copy is complicated. Also, you usually have to download all articles for a language.

Solution

Let's store Wikipedia's content in a peer-to-peer (P2P) system. By leveraging software from the Dat project, we won't have to reinvent the wheel. The Dat protocol efficiently only syncs changes between to versions of data, allows for sparse & live replication and is completely distributed.

This tool can extract articles from a Wikipedia dump or download it directly, and store it in a Dat archive. See below for more details.

Installing

npm install -g build-wikipedia-feed

Usage

This module exposes several command line building blocks.

read all revisions of every article

Pipe a stub-meta-history* XML file into wiki-revisions-list. You will get an ndjson list of page revisions.

curl -s 'https://dumps.wikimedia.org/enwiki/20181001/enwiki-20181001-stub-meta-history1.xml.gz' | gunzip | wiki-revisions-list >revisions.ndjson

read the most recent revision of every article

Pipe a stub-meta-current* XML file file into wiki-revisions-list. You will get an ndjson list of page revisions.

curl -s 'https://dumps.wikimedia.org/enwiki/20181001/enwiki-20181001-stub-meta-current1.xml.gz' | gunzip | wiki-revisions-list >revisions.ndjson

read articles being edited right now

Use wiki-live-revisions. You will get an ndjson list of page revisions.

wiki-live-revisions >revisions.ndjson

fetch & store revisions in a hyperdb

Use wiki-store-revisions to write the HTML content of all revisions in revisions.ndjson into a hyperdb. The archive will be created under p2p-wiki in your system's data directory.

cat revisions.ndjson | wiki-store-revisions

Related

Contributing

If you have a question or have difficulties using build-wikipedia-feed, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to the issues page.