Skip to content

Python3 module for downloading images and videos from Wikimedia Commons - based on now outdated Python 2 scripts (https://github.com/Commonists/CommonsDownloader)

License

Notifications You must be signed in to change notification settings

amckenna41/pyWikiCommons

Repository files navigation

pyWikiCommons

Python package for downloading images and videos from Wikimedia Commons using the Wikimedia API (https://commons.wikimedia.org/w/api.php).

In Development

PyPI

Platforms PythonV License: MIT Build

Issues Size Commits

pyWikiCommonsLogo

Table of Contents

Introduction

pyWikiCommons provides a Python interface for the MediaWiki API [1]. The main purpose of the package is to allow you to download any file/image/video in the Wikipedia/Wikmedia ecosystem using one simple line of code.

The software is currently in its beta stage and only serves its purpose of downloading any file from the Wikimedia database, but there exist an abundance of potential parameters and functionalities of the API that can be exploited moving forward with the software [2].

Requirements

Installation

Install the latest version of pyWikiCommons using pip:

pip3 install pyWikiCommons

Installation from source:

git clone -b master https://github.com/amckenna41/pyWikiCommons.git
python3 setup.py install
cd pyWikiCommons

Usage

Downloading flag of Germany to default output folder:

from pyWikiCommons import pyWikiCommons

pyWikiCommons.download_common_image("File:Flag_of_Germany.svg")

Getting download url of image:

from pyWikiCommons import pyWikiCommons

pyWikiCommons.get_commons_url("File:Flag_of_Germany.svg")

Directories

  • /docs - documentation for pyWikiCommons (pending).
  • /images - all images used throughout the repo.
  • /pyWikiCommons - source code for pyWikiCommons software.
  • /tests - unit and integration tests for pyWikiCommons.

Issues

Any issues, errors or bugs can be raised via the Issues tab in the repository.

Tests

To run all tests, from the main pyWikiCommons repo folder run:

python3 -m unittest discover

To run tests for specific module, from the main pyWikiCommons repo folder run:

python -m unittest tests.MODULE_NAME -v

License

Distributed under the MIT License. See LICENSE for more details.

Contact

If you have any questions or comments, please contact amckenna41@qub.ac.uk or raise an issue on the Issues tab.

LinkedIn

References

[1]: https://www.mediawiki.org/wiki/API:Main_page
[2]: https://commons.wikimedia.org/w/api.php

Back to top

About

Python3 module for downloading images and videos from Wikimedia Commons - based on now outdated Python 2 scripts (https://github.com/Commonists/CommonsDownloader)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages