Crates.io | tools_interface |
lib.rs | tools_interface |
version | 0.1.6 |
source | src |
created_at | 2024-05-21 11:34:39.419138 |
updated_at | 2024-06-03 11:27:40.947855 |
description | Abstractions of serveral Wikipedia/Wikimedia/Wikidata-related tools |
homepage | |
repository | https://github.com/magnusmanske/tools_interface/ |
max_upload_size | |
id | 1246751 |
size | 12,456,769 |
This rust crate implements structs to easily interface with several Wikipedia/Wikidata/Wikimedia tools and APIs.
If you would like to see other tools supported, add a request to the Issue tracker.
The is a ti
binary, working as a command-line interface to the tools_interface library.
It allows you to run queries against various Wikimedia tools from shell.
Use ti help
to get the list of subommands,
and ti help <subcommand>
to get help on a specific subcommand.
Default output format is JSON, so you can pipe the output to jq
for downstream processing.
Pages are listed in the .pages
array, with each page having a title
, a prefixed_title
, and a namespace_id
.
Each page can have additional fields, depending on the tool used.
The .site
object contains the result site's wiki, language and project.
Example: Run a PetScan query with a known PSID, and override two parameters:
ti petscan --id 28348714 --params "foo=bar" "baz=123"
Example: Run Missing Topics on German Wikipedia for the article "Biologie", without template links:
ti missing_topics --wiki dewiki --article Biologie --no_template_links
To convert the output to a more human-readable format, you can use jq
:
# First, pipe your output to a file:
ti SOME_COMMAND > test.json
# Assuming you just want the page titles:
jq -r '.pages[].prefixed_title' < test.json
# Assuming the output has additional `counter` fields:
jq -r '.pages[] | "\(.prefixed_title)\t\(.counter)"' < test.json