Skip to main content

Make ZIM file from iFixit articles

Project description

iFixit

ifixit2zim is an openZIM scraper to create offline versions of iFixit website, in all its supported languages.

CodeFactor Docker License: GPL v3 PyPI version shields.io

This scraper downloads the iFixit resources (categories, guides, ...) and puts them in a ZIM file, a clean and user friendly format for storing content for offline usage.

Usage

ifixit2zim works off a language version that you must provide via the --language argument. The list of supported languages is visible in the --help message.

Docker

docker run -v my_dir:/output openzim/ifixit ifixit2zim --help

Python

ifixit2zim is a Python3 (3.6+) software. If you are not using the Docker image, you are advised to use it in a virtual environment to avoid installing software dependencies on your system. In addition to Python3, you also need to have an up-to-date installation of pip, setuptools and wheel as recommanded here (wheel is important since you will have to build some dependencies).

python3 -m venv .venv
source .venv/bin/activate

# using published version
pip3 install ifixit2zim
ifixit2zim --help

# running from source
pip3 install -r requirements.pip
python3 ifixit2zim/ --help

Call deactivate to quit the virtual environment.

See requirements.txt for the list of python dependencies.

Contributing

All contributions are welcome!

Please open an issue on Github and/or submit a Pull-request.

Guidelines

  • Don't take assigned issues. Comment if those get staled.
  • If your contribution is far from trivial, open an issue to discuss it first.
  • Ensure your code passed black formatting, isort and flake8 (88 chars)

Create an appropriate Python environment

First time:

python3 -m venv .venv
source .venv/bin/activate
pip3 install -r requirements.pip

Next times:

source .venv/bin/activate

NOTA : there is some limitations to the execution of the underlying libzim library on MacOS with some known bugs. The main issue is that the full-text index is not working, so this shouldn't be a problem for quick tests. In doubt, execute the scraper in a Docker container as explained below.

Test the scraper in a Docker container

First, build the Docker image (to be ran in the main folder of this repo):

docker build -t openzim/ifixit:local .

Then run the scraper with CLI arguments needed for your test (everything after ifixit2zim in the example below).

For instance, if you want to run a scrape of only the Apple_PDA category, including its guides, in French :

docker run -it -v $(pwd)/output:/output --rm openzim/fixit:local ifixit2zim --language fr --output /output --tmp-dir /tmp --category Apple_PDA

This will produce a ZIM in the output folder of your current directory.

Test the ZIM produced

To test if the ZIM produced is OK, you should run kiwix-serve, once more with Docker.

For instance, if you produced a file named ifixit_fr_selection_2022-04.zim in the output subfolder, and port 1256 is unused on your machine, you might run:

docker run -it --rm -v $(pwd)/output:/data -p 1256:80 kiwix/kiwix-tools kiwix-serve /data/ifixit_fr_selection_2022-04.zim

And then navigate to (https://localhost:1256) on your favorite browser.

Once test are complete, you might stop the Docker container by pressing Ctrl-C

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ifixit2zim-0.2.1.tar.gz (997.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ifixit2zim-0.2.1-py3-none-any.whl (1.0 MB view details)

Uploaded Python 3

File details

Details for the file ifixit2zim-0.2.1.tar.gz.

File metadata

  • Download URL: ifixit2zim-0.2.1.tar.gz
  • Upload date:
  • Size: 997.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.12

File hashes

Hashes for ifixit2zim-0.2.1.tar.gz
Algorithm Hash digest
SHA256 3ffbad95e6d8f2af080be36e31783f754e4c5c3033ff21664783d02380ecf3a4
MD5 1c7ec4455811a81c103bb823fd56a11c
BLAKE2b-256 18639b0625288544d2d089c2d4c50d02934f12c8ee125e638a7a6fbb8ae8fdb4

See more details on using hashes here.

File details

Details for the file ifixit2zim-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: ifixit2zim-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.12

File hashes

Hashes for ifixit2zim-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 95c45909b91bd6d49f2478c8d45402feca4d64eb364c5ff9cc74b331df9434d8
MD5 41af2c560f260a26848b544381242f1a
BLAKE2b-256 3a12aa1829b4dedb014d3e87d722ed8792428eec96c62548c7a987791b3802c9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page