1

I want to open up an offline version of wikipedia from the command line with a specified article (and preferably a window size and position as well).

I've downloaded wikipedia dumps in several different formats including xml, plain text and zim. I cannot figure out how to access the xml or plain text in a useful manner. I can view the zim file using kiwix but cannot access a certain article from the command line.

Does anyone know how I can open at a specified article, using a command prompt? I'm using a macbook, if it makes any difference. Thanks

1
  • in this context by offline you mean not connected to the internet? so you have the file downloaded locally?
    – user288918
    Feb 21, 2014 at 6:43

1 Answer 1

1

You can use kiwix as a server to host a zim file and then open up pages in a web browser. The open command on Mac OS X will let you specify the page from the command line.

Assuming you have kiwix installed in /Applications, you can use this command to start up the kiwix-server on port 8000:

/Applications/Kiwix.app/Contents/Resources/bin/kiwix-serve path/to/wikipedia.zim --port=8000 &

Then you can access your Wikipedia dump with

open http://127.0.0.1:8000/

I'm not sure of anyway of making a dump of the all the urls in the zim file, but any that you find either manually, or by figuring out a dump method should be usable with open. I made a small book with Wikipedia book creator and downloaded it as a zim file. Commands like the following worked fine for me:

open http://127.0.0.1:8000/Some_Code_Languages/A/Python%20%28programming%20language%29

Also, don't forget to stop the kiwix-server process when you're done and before you close your terminal. Use the fg command to bring it to the foreground and <Ctrl>-c to stop it. Alternatively hunt it down in Activity Monitor.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .