Using MediaWiki's API, retrieve pages that belong to a given category
Project description
mw-category-members
Using MediaWiki's API: retrieve pages that belong to a given category
Installation
pip install mw_category_members
Usage
import category_members
results = category_members.retrieve('Category:Presidents_of_the_United_States')
for r in results:
print(r['name'], r['link'])
Arguments
def retrieve(cat_name, mw_instance='https://en.wikipedia.org', types=['page', 'subcat', 'file'], clean_subcat_names=False):
- cat_name: Category name e.g. 'Category:Presidents_of_the_United_States'.
- mw_instance: Which MediaWiki instance to use (the URL 'origin'). Defaults to 'https://en.wikipedia.org'.
- types: Which types of pages to retrieve. Defaults to
['page', 'subcat', 'file']
. - clean_subcat_names: If
True
, removes the e.g. 'Category:' prefix of the titles. Defaults toFalse
.
Returns
Array of pages where a page is a dictionary of {'name': 'some name', 'link': 'some absolute link'}
.
License
MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for mw_category_members-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8be27a6c20e67fa5c055c68b38214acc8e287391b459f13cd7ecc551950de745 |
|
MD5 | 1d36eda6c81c95f0979182c552a0c5ba |
|
BLAKE2b-256 | 158fae86267dded0ee6c1e7189e8177cafac3aa7890a023a27ff068d3bd8c4f4 |
Close
Hashes for mw_category_members-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d86149066118f856648126538b75e9d6702138fcf790cc73455435c8be0ff0f |
|
MD5 | bb151c23b96994d8fcd5326b05dc55e0 |
|
BLAKE2b-256 | dfdb62603c664688398e2aa0a12f6d9848b4d402d2e4a1f33b4752c76f823314 |