Package: wikiget
wikigetSomething likewgetfor downloading a file from MediaWiki sites (like Wikipedia or Wikimedia Commons) using only the
file name or the URL of its description page.InstallationRequires Python 3.7+ and pip. Install the latest version with:pipinstallwikigetFor the latest features, at the risk of bugs and undocumented behavior, you can install the development version directly
fromGitHub:pipinstallhttps://github.com/clpo13/wikiget/archive/refs/heads/master.zipUsagewikiget [-h] [-V] [-q | -v] [-f] [-s SITE] [-P PATH] [-u USERNAME] [-p PASSWORD] [-o OUTPUT | -a] [-l LOGFILE] [-j THREADS] FILEThe only required parameter isFILE, which is the file you want to download. It can either be the name of the file on
the wiki, including the namespace prefix, or a link to the file description page. IfFILEis in the formFile:Example.jpgorImage:Example.jpg, it will be fetched from the default site, which is "commons.wikimedia.org".
If it's the fully-qualified URL of a file description page, likehttps://en.wikipedia.org/wiki/File:Example.jpg, the
file is fetched from the site in the URL, in this case "en.wikipedia.org". Note: full URLs may contain characters your
shell interprets differently, so you can either escape those characters with a backslash\or surround the entire URL
with single'or double"quotes. Use of a fully-qualified URL like this may require setting the--pathflag (see
next paragraph).The site can also be specified with the--siteflag, though this will not have any effect if the full URL is given.
Non-Wikimedia sites should work, but you may need to specify the wiki's script path with--path(whereindex.phpandapi.phplive; on Wikimedia sites it's/w/, but other sites may use/or something else entirely). Private wikis
(those requiring login even for read access) are also supported with the use of the--usernameand--passwordflags.More detailed information, such as the site used and full URL of the file, can be displayed with-vor--verbose.
Use-vvto display even more detail, mainly debugging information or API messages.-qcan be used to silence
warnings.  A logfile can be specified with-lor--logfile. If this option is present, the logfile will contain the
same information as-valong with timestamps. New log entries will be appended to an existing logfile.By default, the program won't overwrite existing files with the same name as the target, but this can be forced with-for--force. Additionally, the file can be downloaded to a different name with-o.Files can be batch downloaded with the-aor--batchflag. In this mode,FILEwill be treated as an input file
containing multiple files to download, one filename or URL per line. Blank lines and lines starting with "#" are
ignored. If an error is encountered, execution stops immediately and the offending filename is printed. For large
batches, the process can be sped up by downloading files in parallel. The number of parallel downloads can be set with-j. For instance, with-a -j4, wikiget will download four files at once. Without-jor with-jby itself without
a number, wikiget will download the files one at a time.Example usagewikigetFile:Example.jpg
wikiget--siteen.wikipedia.orgFile:Example.jpg
wikigethttps://en.wikipedia.org/wiki/File:Example.jpg-otest.jpgFuture plansoptional machine-readable (JSON) log outputbatch download by (Commons) category or user uploadsmaybe: download Wikipedia articles, in plain text, wikitext, or other formatsContributingPull requests, bug reports, or feature requests are more than welcome.It's recommended that you use avirtual environment managerlike venv orvirtualenvto create an isolated
environment in which to install this package's dependencies as not to clutter your system Python environment:# if you plan on submitting pull requests, fork the repo on GitHub and clone that insteadgitclonehttps://github.com/clpo13/wikigetcdwikiget

python3-mvenvvenv# orvirtualenvvenvTo activate the virtual environment, use one of the following commands:# Linux and macOS; activate.csh and activate.fish are also availablesourcevenv/bin/activate# Windows (Command Prompt or PowerShell).\venv\Scripts\activateThen runpip install -e .to invoke an"editable" install, meaning any changes made to the source will be
reflected immediately in the executable script. Unit tests can be run withpytest(make sure to runpip install pytestin the virtual environment first.)Alternatively, usingHatch, simply clone the repository and runhatch run testto create the environment and run
pytest all in one go. Wikiget can also be run directly in the Hatch environment withhatch run wikiget [...].LicenseCopyright (C) 2018-2023 Cody Logan and contributorsThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
version.This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.You should have received a copy of the GNU General Public License along with this program. If not, seehttps://www.gnu.org/licenses/.