{"id":15134714,"url":"https://github.com/saveweb/wikiteam3","last_synced_at":"2025-09-29T03:30:59.542Z","repository":{"id":65240757,"uuid":"582759705","full_name":"saveweb/wikiteam3","owner":"saveweb","description":"archiving MediaWikis (and uploading wikidump to the Internet Archive)","archived":false,"fork":true,"pushed_at":"2024-12-04T09:27:27.000Z","size":70506,"stargazers_count":30,"open_issues_count":4,"forks_count":4,"subscribers_count":4,"default_branch":"v4-main","last_synced_at":"2024-12-04T09:29:50.224Z","etag":null,"topics":["internet-archive","mediawiki","wiki"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/wikiteam3/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"mediawiki-client-tools/mediawiki-dump-generator","license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/saveweb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-12-27T19:43:02.000Z","updated_at":"2024-12-04T09:27:36.000Z","dependencies_parsed_at":"2023-09-23T19:11:50.322Z","dependency_job_id":null,"html_url":"https://github.com/saveweb/wikiteam3","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saveweb%2Fwikiteam3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saveweb%2Fwikiteam3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saveweb%2Fwikiteam3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saveweb%2Fwikiteam3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saveweb","download_url":"https://codeload.github.com/saveweb/wikiteam3/tar.gz/refs/heads/v4-main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234583683,"owners_count":18856280,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["internet-archive","mediawiki","wiki"],"created_at":"2024-09-26T05:23:53.536Z","updated_at":"2025-09-29T03:30:59.528Z","avatar_url":"https://github.com/saveweb.png","language":"Python","readme":"# `wikiteam3`\n\n![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Farchive.org%2Fadvancedsearch.php%3Fq%3Dsubject%3Awikiteam3%26rows%3D1%26page%3D1%26output%3Djson\u0026query=%24.response.numFound\u0026label=WikiTeam3%20Dumps%40IA)\n[![PyPI version](https://badge.fury.io/py/wikiteam3.svg)](https://badge.fury.io/py/wikiteam3)\n\n\u003c!-- ![\"MediaWikiArchive.png\"](./MediaWikiArchive.png) --\u003e\n\u003cdiv align=center\u003e\u003cimg width = \"150\" height =\"150\" src =\"https://raw.githubusercontent.com/saveweb/wikiteam3/v4-main/MediaWikiArchive.png\"/\u003e\u003c/div\u003e\n\n\u003e Countless MediaWikis are still waiting to be archived.\n\u003e\n\u003e _Image by [@gledos](https://github.com/gledos/)_\n\n`wikiteam3` is a fork of `mediawiki-scraper`.\n\n\u003cdetails\u003e\n\n## Why we fork mediawiki-scraper\n\nOriginally, mediawiki-scraper was named wikiteam3, but wikiteam upstream (py2 version) suggested that the name should be changed to avoid confusion with the original wikiteam.  \nHalf a year later, we didn't see any py3 porting progress in the original wikiteam, and mediawiki-scraper lacks \"code\" reviewers.  \nSo, we decided to break that suggestion, fork and named it back to wikiteam3, put the code here, and release it to pypi wildly.\n\nEverything still under GPLv3 license.\n\n\u003c/details\u003e\n\n## For webmaster\n\nWe archive every MediaWiki site yearly and upload to the Internet Archive.\nWe crawl sites with 1.5s crawl-delay by default, and we respect Retry-After header.\nIf you don’t want your wiki to be archived, add the following to your `\u003cdomain\u003e/robots.txt`:\n\n```robots.txt\nUser-agent: wikiteam3\nDisallow: /\n```\n\nOur bots are running on the following IPs: [wikiteam3.txt](https://static.saveweb.org/bots_ips/wikiteam3.txt) (ips+info) | [wikiteam3.ips.txt](https://static.saveweb.org/bots_ips/wikiteam3.ips.txt) (ips)\n\n## Installation/Upgrade\n\n```shell\npip install wikiteam3 --upgrade\n```\n\n\u003e[!NOTE]\n\u003e For public MediaWiki, you don't need to install wikiteam3 locally. You can send an archive request (include the reason for the archive request, e.g. wiki is about to shutdown, need a wikidump to migrate to another wikifarm, etc.) to the wikiteam IRC channel. An online member will run a [wikibot](https://wikibot.digitaldragon.dev/) job for your request.\n\u003e\n\u003e Even more, we also accept DokuWiki and PukiWiki archive requests.\n\u003e \n\u003e - wikiteam IRC (webirc): \u003chttps://chat.hackint.org/?join=%23wikiteam\u003e\n\u003e - wikiteam IRC logs: https://irclogs.archivete.am/wikiteam\n\n## Dumpgenerator usage\n\n\u003c!-- DUMPER --\u003e\n\u003cdetails\u003e\n\n```bash\nusage: wikiteam3dumpgenerator [-h] [-v] [--cookies cookies.txt] [--delay 1.5]\n                              [--retries 5] [--hard-retries 3] [--path PATH]\n                              [--resume] [--force] [--user USER]\n                              [--pass PASSWORD] [--http-user HTTP_USER]\n                              [--http-pass HTTP_PASSWORD] [--insecure]\n                              [--verbose] [--api_chunksize 50] [--api API]\n                              [--index INDEX] [--index-check-threshold 0.80]\n                              [--xml] [--curonly] [--xmlapiexport]\n                              [--xmlrevisions] [--xmlrevisions_page]\n                              [--redirects] [--namespaces 1,2,3]\n                              [--exnamespaces 1,2,3] [--images]\n                              [--bypass-cdn-image-compression]\n                              [--image-timestamp-interval 2019-01-02T01:36:06Z/2023-08-12T10:36:06Z]\n                              [--ia-wbm-booster {0,1,2,3}]\n                              [--assert-max-pages 123]\n                              [--assert-max-edits 123]\n                              [--assert-max-images 123]\n                              [--assert-max-images-bytes 123]\n                              [--get-wiki-engine] [--failfast] [--upload]\n                              [-g UPLOADER_ARGS]\n                              [wiki]\n\noptions:\n  -h, --help            show this help message and exit\n  -v, --version         show program's version number and exit\n  --cookies cookies.txt\n                        path to a cookies.txt file\n  --delay 1.5           adds a delay (in seconds) [NOTE: most HTTP servers\n                        have a 5s HTTP/1.1 keep-alive timeout, you should\n                        consider it if you wanna reuse the connection]\n  --retries 5           Maximum number of retries for each request before\n                        failing.\n  --hard-retries 3      Maximum number of hard retries for each request before\n                        failing. (for now, this only controls the hard retries\n                        during images downloading)\n  --path PATH           path to store wiki dump at\n  --resume              resumes previous incomplete dump (requires --path)\n  --force               download it even if Wikimedia site or a recent dump\n                        exists in the Internet Archive\n  --user USER           Username if MediaWiki authentication is required.\n  --pass PASSWORD       Password if MediaWiki authentication is required.\n  --http-user HTTP_USER\n                        Username if HTTP authentication is required.\n  --http-pass HTTP_PASSWORD\n                        Password if HTTP authentication is required.\n  --insecure            Disable SSL certificate verification\n  --verbose\n  --api_chunksize 50    Chunk size for MediaWiki API (arvlimit, ailimit, etc.)\n\n  wiki                  URL to wiki (e.g. http://wiki.domain.org), auto\n                        detects API and index.php\n  --api API             URL to API (e.g. http://wiki.domain.org/w/api.php)\n  --index INDEX         URL to index.php (e.g.\n                        http://wiki.domain.org/w/index.php), (not supported\n                        with --images on newer(?) MediaWiki without --api)\n  --index-check-threshold 0.80\n                        pass index.php check if result is greater than (\u003e)\n                        this value (default: 0.80)\n\nData to download:\n  What info download from the wiki\n\n  --xml                 Export XML dump using Special:Export (index.php).\n                        (supported with --curonly)\n  --curonly             store only the latest revision of pages\n  --xmlapiexport        Export XML dump using API:revisions instead of\n                        Special:Export, use this when Special:Export fails and\n                        xmlrevisions not supported. (supported with --curonly)\n  --xmlrevisions        Export all revisions from an API generator\n                        (API:Allrevisions). MediaWiki 1.27+ only. (not\n                        supported with --curonly)\n  --xmlrevisions_page   [[! Development only !]] Export all revisions from an\n                        API generator, but query page by page MediaWiki 1.27+\n                        only. (default: --curonly)\n  --redirects           Dump page redirects via API:Allredirects\n  --namespaces 1,2,3    comma-separated value of namespaces to include (all by\n                        default)\n  --exnamespaces 1,2,3  [lack maintenance] comma-separated value of namespaces\n                        to exclude\n  --images              Generates an image dump\n\nImage dump options:\n  Options for image dump (--images)\n\n  --bypass-cdn-image-compression\n                        Bypass CDN image compression. (CloudFlare Polish,\n                        etc.) [WARNING: This will increase CDN origin traffic,\n                        and not effective for all HTTP Server/CDN, please\n                        don't use this blindly.]\n  --image-timestamp-interval 2019-01-02T01:36:06Z/2023-08-12T10:36:06Z\n                        Only download images uploaded in the given time\n                        interval. [format: ISO 8601 UTC interval] (only works\n                        with api)\n  --ia-wbm-booster {0,1,2,3}\n                        Download images from Internet Archive Wayback Machine\n                        if possible, reduce the bandwidth usage of the wiki.\n                        [0: disabled (default), 1: use earliest snapshot, 2:\n                        use latest snapshot, 3: the closest snapshot to the\n                        image's upload time]\n\nAssertions:\n  What assertions to check before actually downloading, if any assertion\n  fails, program will exit with exit code 45. [NOTE: This feature requires\n  correct siteinfo API response from the wiki, and not working properly with\n  some wikis. But it's useful for mass automated archiving, so you can\n  schedule a re-run for HUGE wiki that may run out of your disk]\n\n  --assert-max-pages 123\n                        Maximum number of pages to download\n  --assert-max-edits 123\n                        Maximum number of edits to download\n  --assert-max-images 123\n                        Maximum number of images to download\n  --assert-max-images-bytes 123\n                        Maximum number of bytes to download for images [NOTE:\n                        this assert happens after downloading images list]\n\nMeta info:\n  What meta info to retrieve from the wiki\n\n  --get-wiki-engine     returns the wiki engine\n  --failfast            [lack maintenance] Avoid resuming, discard failing\n                        wikis quickly. Useful only for mass downloads.\n\nwikiteam3uploader params:\n  --upload              (run `wikiteam3uplaoder` for you) Upload wikidump to\n                        Internet Archive after successfully dumped\n  -g, --uploader-arg UPLOADER_ARGS\n                        Arguments for uploader.\n\n```\n\u003c/details\u003e\n\n\u003c!-- DUMPER --\u003e\n\n### Downloading a wiki with complete XML history and images\n\n```bash\nwikiteam3dumpgenerator http://wiki.domain.org --xml --images\n```\n\n\u003e[!WARNING]\n\u003e\n\u003e `NTFS/Windows` users please note: When using `--images`, because NTFS does not allow characters such as `:*?\"\u003c\u003e|` in filenames, some files may not be downloaded, please pay attention to the `XXXXX could not be created by OS` error in your `errors.log`.\n\u003e We will not make special treatment for NTFS/EncFS \"path too long/illegal filename\", highly recommend you to use ext4/xfs/btrfs, etc.\n\u003e \u003cdetails\u003e\n\u003e - Introducing the \"illegal filename rename\" mechanism will bring complexity. WikiTeam(python2) had this before, but it caused more problems, so it was removed in WikiTeam3.\n\u003e - It will cause confusion to the final user of wikidump (usually the Wiki site administrator).\n\u003e - NTFS is not suitable for large-scale image dump with millions of files in a single directory.(Windows background service will occasionally scan the whole disk, we think there should be no users using WIN/NTFS to do large-scale MediaWiki archive)\n\u003e - Using other file systems can solve all problems.\n\u003e \u003c/details\u003e\n\n### Manually specifying `api.php` and/or `index.php`\n\nIf the script can't find itself the `api.php` and/or `index.php` paths, then you can provide them:\n\n```bash\nwikiteam3dumpgenerator --api http://wiki.domain.org/w/api.php --xml --images\n```\n\n```bash\nwikiteam3dumpgenerator --api http://wiki.domain.org/w/api.php --index http://wiki.domain.org/w/index.php \\\n    --xml --images\n```\n\nIf you only want the XML histories, just use `--xml`. For only the images, just `--images`. For only the current version of every page, `--xml --curonly`.\n\n### Resuming an incomplete dump\n\n\u003cdetails\u003e\n\n```bash\nwikiteam3dumpgenerator \\\n    --api http://wiki.domain.org/w/api.php --xml --images --resume --path /path/to/incomplete-dump\n```\n\nIn the above example, `--path` is only necessary if the download path (wikidump dir) is not the default.\n\n\u003e[!NOTE]\n\u003e\n\u003e en: When resuming an incomplete dump, the configuration in `config.json` will override the CLI parameters. (But not all CLI parameters will be ignored, check `config.json` for details)\n\n`wikiteam3dumpgenerator` will also ask you if you want to resume if it finds an incomplete dump in the path where it is downloading.\n\n\u003c/details\u003e\n\n## Using `wikiteam3uploader`\n\n\u003c!-- UPLOADER --\u003e\n\u003cdetails\u003e\n\n```bash\nusage:  Upload wikidump to the Internet Archive. [-h] [-kf KEYS_FILE]\n                                                 [-c COLLECTION] [--dry-run]\n                                                 [-u] [--bin-zstd BIN_ZSTD]\n                                                 [--zstd-level {17,18,19,20,21,22}]\n                                                 [--rezstd]\n                                                 [--rezstd-endpoint URL]\n                                                 [--bin-7z BIN_7Z]\n                                                 [--parallel]\n                                                 wikidump_dir\n\npositional arguments:\n  wikidump_dir\n\noptions:\n  -h, --help            show this help message and exit\n  -kf, --keys_file KEYS_FILE\n                        Path to the IA S3 keys file. (first line: access key,\n                        second line: secret key) [default:\n                        ~/.wikiteam3_ia_keys.txt]\n  -c, --collection COLLECTION\n  --dry-run             Dry run, do not upload anything.\n  -u, --update          Update existing item. [!! not implemented yet !!]\n  --bin-zstd BIN_ZSTD   Path to zstd binary. [default: zstd]\n  --zstd-level {17,18,19,20,21,22}\n                        Zstd compression level. [default: 17] If you have a\n                        lot of RAM, recommend to use max level (22).\n  --rezstd              [server-side recompression] Upload pre-compressed zstd\n                        files to rezstd server for recompression with best\n                        settings (which may eat 10GB+ RAM), then download\n                        back. (This feature saves your lowend machine, lol)\n  --rezstd-endpoint URL\n                        Rezstd server endpoint. [default: http://pool-\n                        rezstd.saveweb.org/rezstd/] (source code:\n                        https://github.com/yzqzss/rezstd)\n  --bin-7z BIN_7Z       Path to 7z binary. [default: 7z]\n  --parallel            Parallelize compression tasks\n\n```\n\u003c/details\u003e\n\n\u003c!-- UPLOADER --\u003e\n\n### Requirements\n\n\u003e [!NOTE]\n\u003e\n\u003e Please make sure you have the following requirements before using `wikiteam3uploader`, and you don't need to install them if you don't wanna upload the dump to IA.\n\n- unbinded localhost port 62954 (for multiple processes compressing queue)\n- 3GB+ RAM (~2.56GB for commpressing)\n- 64-bit OS (required by 2G `wlog` size)\n\n- `7z` (binary)\n    \u003e Debian/Ubuntu: install `p7zip-full`  \n\n    \u003e [!NOTE]\n    \u003e\n    \u003e Windows: install \u003chttps://7-zip.org\u003e and add `7z.exe` to PATH\n- `zstd` (binary)\n    \u003e 1.5.5+ (recommended), v1.5.0-v1.5.4(DO NOT USE), 1.4.8 (minimum)  \n    \u003e install from \u003chttps://github.com/facebook/zstd\u003e  \n\n    \u003e [!NOTE]\n    \u003e\n    \u003e Windows: add `zstd.exe` to PATH\n\n### Uploader usage\n\n\u003e [!NOTE]\n\u003e\n\u003e Read `wikiteam3uploader --help` and do not forget `~/.wikiteam3_ia_keys.txt` before using `wikiteam3uploader`.\n\n```bash\nwikiteam3uploader {YOUR_WIKI_DUMP_PATH}\n```\n\n## Checking dump integrity\n\nTODO: xml2titles.py\n\nIf you want to check the XML dump integrity, type this into your command line to count title, page and revision XML tags:\n\n```bash\ngrep -E '\u003ctitle(.*?)\u003e' *.xml -c; grep -E '\u003cpage(.*?)\u003e' *.xml -c; grep \\\n    \"\u003c/page\u003e\" *.xml -c;grep -E '\u003crevision(.*?)\u003e' *.xml -c;grep \"\u003c/revision\u003e\" *.xml -c\n```\n\nYou should see something similar to this (not the actual numbers) - the first three numbers should be the same and the last two should be the same as each other:\n\n```bash\n580\n580\n580\n5677\n5677\n```\n\nIf your first three numbers or your last two numbers are different, then, your XML dump is corrupt (it contains one or more unfinished ```\u003c/page\u003e``` or ```\u003c/revision\u003e```). This is not common in small wikis, but large or very large wikis may fail at this due to truncated XML pages while exporting and merging. The solution is to remove the XML dump and re-download, a bit boring, and it can fail again.\n\n## import wikidump to MediaWiki / wikidump data tips\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e In the article name, spaces and underscores are treated as equivalent and each is converted to the other in the appropriate context (underscore in URL and database keys, spaces in plain text). \u003chttps://www.mediawiki.org/wiki/Manual:Title.php#Article_name\u003e\n\n\u003e [!NOTE]\n\u003e\n\u003e `WikiTeam3` uses `zstd` to compress `.xml` and `.txt` files, and `7z` to pack images (media files).  \n\u003e `zstd` is a very fast stream compression algorithm, you can use `zstd -d` to decompress `.zst` file/steam.\n\n## Contributors\n\n**WikiTeam** is the [Archive Team](http://www.archiveteam.org) [[GitHub](https://github.com/ArchiveTeam)] subcommittee on wikis.\nIt was founded and originally developed by [Emilio J. Rodríguez-Posada](https://github.com/emijrp), a Wikipedia veteran editor and amateur archivist. Thanks to people who have helped, especially to: [Federico Leva](https://github.com/nemobis), [Alex Buie](https://github.com/ab2525), [Scott Boyd](http://www.sdboyd56.com), [Hydriz](https://github.com/Hydriz), Platonides, Ian McEwen, [Mike Dupont](https://github.com/h4ck3rm1k3), [balr0g](https://github.com/balr0g) and [PiRSquared17](https://github.com/PiRSquared17).\n\n**Mediawiki-Scraper** The Python 3 initiative is currently being led by [Elsie Hupp](https://github.com/elsiehupp), with contributions from [Victor Gambier](https://github.com/vgambier), [Thomas Karcher](https://github.com/t-karcher), [Janet Cobb](https://github.com/randomnetcat), [yzqzss](https://github.com/yzqzss), [NyaMisty](https://github.com/NyaMisty) and [Rob Kam](https://github.com/robkam)\n\n**WikiTeam3** Every archivist who has uploaded a wikidump to the [Internet Archive](https://archive.org/search?query=subject%3Awikiteam3).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaveweb%2Fwikiteam3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaveweb%2Fwikiteam3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaveweb%2Fwikiteam3/lists"}