Metadata-Version: 2.4
Name: download-mediawiki
Version: 1.0.1
Summary: OXL Wiki-Download Script for MediaWiki instances
Author-email: Rath Pascal <contact@oxl.at>
License: MIT License
        
        Copyright (c) 2025 OXL
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://www.OXL.at
Project-URL: Documentation, https://github.com/O-X-L/wiki-download-mediawiki
Project-URL: Repository, https://github.com/O-X-L/wiki-download-mediawiki.git
Project-URL: Issues, https://github.com/O-X-L/wiki-download-mediawiki/issues
Keywords: wiki,mirror,archive,converter,downloader
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Dynamic: license-file

# MediaWiki Download Script

[![Lint](https://github.com/O-X-L/wiki-download-mediawiki/actions/workflows/lint.yml/badge.svg?branch=latest)](https://github.com/O-X-L/wiki-download-mediawiki/actions/workflows/lint.yml)
[![Test](https://github.com/O-X-L/wiki-download-mediawiki/actions/workflows/test.yml/badge.svg?branch=latest)](https://github.com/O-X-L/wiki-download-mediawiki/actions/workflows/test.yml)

This is a very simple script to download the whole contents of MediaWiki instance via its [API](https://www.mediawiki.org/wiki/API).

This script should not be used to download huge Wiki's as it will not scale well!

----

## Features

* Downloading the content of all pages in their source-format
  * Only downloading the latest revision (`rvlimit`)
* Optionally converting all source-files to Markdown-format (using `pandoc`)

We did not yet have the need to also download the images. Feel free to open a PR!

----

## Usage

Install:
```bash
pip install download-mediawiki

# or clone & run directly
python3 src/download_mediawiki/
```

Arguments:
```bash
download-mediawiki --help
> usage: MediaWiki Download Script (© OXL IT Services, License: MIT) [-h] -u URL [-o OUT_DIR] [-r]
>                                                                    [-m]
> 
> options:
>   -h, --help            show this help message and exit
>   -u URL, --url URL     Base-URL of the MediaWiki instance
>   -o OUT_DIR, --out-dir OUT_DIR
>   -r, --replace         Replace/Update existing pages
>   -m, --convert-to-md   Convert all source-files to Markdown-format (pandoc executable
>                         required!)
```

----

## Result

**Overview: dump/overview.json**

```bash
# namespace-id => page-id => page-title
cat dump/overview.json 
> {
>   "0": {
>     "1": "Page Title"
>   },
>   "15": {}
> }
```

**Files: dump/<namespace-id>/<page-id>.mw**

```bash
tree dump/
> dump/
> ├── 0
> │   ├── 1.mw
```

**Content**

```bash
head dump/0/1.mw 
> # Main Page
> Welcome to the ''nftables'' HOWTO documentation page. Here you will find documentation on how to build, install, configure and use nftables.
> 
> If you have any suggestion to improve it, please send your comments to Netfilter users mailing list <netfilter@vger.kernel.org>.
> 
> 
> = [[News]] =
> 
> 
> = Introduction =
```
