Gangmax Blog

自由之思想,独立之精神

Kiwix Zim & Zimply

| Comments

Kiwix is an offline solution that allows you to access educational content like Wikipedia, the Wiktionary, TED talks and many others on any computer or mobile device. Kiwix provides the offline archives in zim format on its website. In your Kiwix client you can download the archived files to read.

You can also open a zim format file and get the content with a program. For an example, use zimply:

1
pip install zimply
1
2
3
4
5
6
# From: https://github.com/kimbauters/ZIMply
# You can download zim files from:
# http://wiki.kiwix.org/wiki/Content_in_all_languages
# https://www.mirrorservice.org/sites/download.kiwix.org/zim/
from zimply import ZIMServer
ZIMServer("wiki.zim")

Note that in my “Python 3.5.1” environment, the above code reports the following error:

1
2
3
4
5
6
7
8
9
10
>>> from zimply import ZIMServer
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/gang/.pyenv/versions/3.5.1/lib/python3.5/site-packages/zimply/__init__.py", line 1, in <module>
    from .zimply import ZIMServer
  File "/home/gang/.pyenv/versions/3.5.1/lib/python3.5/site-packages/zimply/zimply.py", line 39, in <module>
    import lzma
  File "/home/gang/.pyenv/versions/3.5.1/lib/python3.5/lzma.py", line 26, in <module>
    from _lzma import *
ImportError: No module named '_lzma'

This error can be workaroud by using “Python 3.4.4” with pyenv and then install zimply. After running the “ZIMServer” with a zim file, you can use your browser to read the content in the zim file from ”http://localhost:9454”.

For the zim files, Kiwix saves them under the following locations of your computer:

1
2
3
# Linux: /home/userx/.www.kiwix.org/kiwix/lwd7d6we.default/data/content
# Windows: C:\Users\userx\AppData\Roaming\www.kiwix.org\Kiwix\Profiles\njgozt9w.default\data\content 
# Note that the "lwd7d6we" and "njgozt9w" strings in the path strings might be a ramdom string.

Comments