Skip to main content

Modern CLI utility for extracting structured data from Old School RuneScape Wiki

Project description

osrs-wiki-cli

Python 3.8+ License: MIT GitHub release

A modern CLI utility for extracting structured data from the Old School RuneScape Wiki. Built for developers who need clean, programmatically accessible data formats for RuneLite plugins, web applications, and data analysis workflows.

Features

  • 🔌 Plugin-Ready Data Formats - JSON and CSV outputs optimized for RuneLite plugins and external tools
  • 📊 Structured Data Extraction - Clean API responses suitable for databases and spreadsheet analysis
  • 🔍 MediaWiki API Integration - Direct JSON access without HTML parsing dependencies
  • 📄 Multiple Output Formats - JSON, CSV, and raw text formats for different integration needs
  • 🏗️ Modular Commands - Composable subcommands for specific data extraction tasks
  • 🛡️ Developer-Friendly - Rate limiting, error handling, and batch processing support

Quick Start

# Extract Lua module data for plugin development  
osrs-wiki-cli source "Module:SlayerConsts/MasterTables" --format json

# Get calculator configurations with dependencies
osrs-wiki-cli source "Calculator:Agility" --templates --format text

# List all items in a category for data analysis
osrs-wiki-cli category "Items" --format csv --limit 50

# Extract template structure for parsing
osrs-wiki-cli source "Template:Infobox Item" --format text

Installation

  1. Clone the repository:

    git clone https://github.com/cloud-aspect/osrs-wiki-cli.git
    cd osrs-wiki-cli
    
  2. Install osrs-wiki-cli:

    # Option 1: Install from PyPI (recommended)
    pip install osrs-wiki-cli
    
    # Option 2: Install from source
    python -m venv venv
    venv\Scripts\activate  # Windows
    # or
    source venv/bin/activate  # Linux/macOS
    pip install requests beautifulsoup4
    

Usage

The tool provides commands designed for different integration workflows:

Commands

  • source - Extract raw source code, templates, and dependencies for custom parsing
  • category - Generate complete page lists for building indexes and data catalogs
  • page (planned) - Extract parsed tables and infoboxes in structured formats
  • search (planned) - Search wiki content with filtering for targeted data discovery

Integration Examples

# Extract all items for a trading application database
osrs-wiki-cli category "Items" --format csv --save

# Get monster data for combat calculator development  
osrs-wiki-cli category "Monsters" --format json --limit 100

# Extract Lua modules for game logic integration
osrs-wiki-cli source "Module:SlayerConsts/MasterTables" --format text

Data Integration Examples

RuneLite Plugin Development

// Using extracted JSON data in a RuneLite plugin
@Slf4j
public class WikiDataPlugin extends Plugin {
    private Map<String, ItemInfo> itemDatabase;
    
    @Override
    protected void startUp() {
        // Load extracted wiki data: python wiki_tool.py category "Items" --format json
        itemDatabase = loadWikiItemData("data/categories/Items.json");
        log.info("Loaded {} items from wiki extraction", itemDatabase.size());
    }
}

Web Application Integration

// Load extracted category data for web app
async function loadGameData() {
    // Data from: python wiki_tool.py category "Calculators" --format json --save
    const calculators = await fetch('/data/categories/Calculators.json').then(r => r.json());
    
    // Build searchable calculator index
    const searchIndex = calculators.pages.map(calc => ({
        name: calc.title.replace('Calculator:', ''),
        url: calc.title,
        lastUpdated: calc.timestamp
    }));
    
    return { calculators: searchIndex };
}

Database Loading

# Load extracted CSV data into pandas/SQLite
import pandas as pd
import sqlite3

# Load data from: osrs-wiki-cli category "Items" --format csv --save  
df = pd.read_csv('data/categories/Items.csv')

# Create searchable database
conn = sqlite3.connect('osrs_data.db')
df.to_sql('wiki_items', conn, if_exists='replace', index=False)

# Query for item lookup
items = pd.read_sql("SELECT * FROM wiki_items WHERE title LIKE '%sword%'", conn)
print(f"Found {len(items)} sword items")

For detailed usage instructions, see the User Guide.

Documentation

Project Background

This tool provides developers and data analysts with programmatic access to the OSRS Wiki's extensive structured content, including:

  • Lua Modules: Complete game logic and data tables for plugin integration
  • Calculator Configurations: JavaScript and template-based calculators with parameters
  • Category Systems: Comprehensive lists for building complete datasets
  • Template Structures: Underlying data formats for custom parsing solutions

The extracted data formats are designed for seamless integration into RuneLite plugins, web applications, mobile apps, databases, and custom analysis tools.

Contributing

We welcome contributions! Please see our Contributing Guide for details on:

  • Setting up the development environment
  • Code style and standards
  • Submitting pull requests
  • Reporting issues

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Related Projects

  • sqlite-utils - CLI tool and library for SQLite databases
  • osrs-cli - Command line tools for OSRS calculations
  • RuneLite - Open source OSRS client with extensive APIs

Need help? Check out the FAQ or open an issue.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

osrs_wiki_cli-1.0.0.tar.gz (30.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

osrs_wiki_cli-1.0.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file osrs_wiki_cli-1.0.0.tar.gz.

File metadata

  • Download URL: osrs_wiki_cli-1.0.0.tar.gz
  • Upload date:
  • Size: 30.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for osrs_wiki_cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3ffcfe84f3a9fa832ca41932899ec0bfda504bd17e99cb9816a4138f62557917
MD5 e101103c41df3ec85fd0cbe9c49574b8
BLAKE2b-256 e4b5f7115fdb482b8a745ba6d6af4307095fd31bdabbd2bcb5968d5f35668498

See more details on using hashes here.

Provenance

The following attestation bundles were made for osrs_wiki_cli-1.0.0.tar.gz:

Publisher: publish.yml on cloud-aspect/osrs-wiki-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file osrs_wiki_cli-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: osrs_wiki_cli-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for osrs_wiki_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2a7931e088b270bd6e692e4e01b00a4687c1c3dc18c2d228d0f19562021fccb
MD5 fd0543fc6995c512db7370a00fc4d038
BLAKE2b-256 8c15a7051a756f0309a76cb3283c34684ea818b5a4e34634a0e3b73777f4b3c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for osrs_wiki_cli-1.0.0-py3-none-any.whl:

Publisher: publish.yml on cloud-aspect/osrs-wiki-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page