Skip to main content

Scrape Wikipedia tables into CSVs or JSON

Project description

wikiscraperx

Overview

This repository contains the wikiscraperx project, a Python script designed to scrape tables from HTML documents and save them as CSV files. The project consists of two main Python files:

  1. tableParser.py: logic for parsing HTML tables.
  2. mainCli.py: CLI interface for the application.

Prerequisites

  • Python 3.x
  • Additional Python packages, as listed in requirements.txt.

Installation

To install the latest version:

pip install wikiscraperx

Or install from source:

git clone https://github.com/Joseph-Press/wikiscraperx.git
cd wikiscraperx
pip install .

Usage

Command Line Interface

Scrape all tables from a Wikipedia page to a folder (default CSV):

wikiscraperx --url "https://en.wikipedia.org/wiki/Python_(programming_language)" --output-folder ./output

Scrape to JSON format:

wikiscraperx --url "https://en.wikipedia.org/wiki/Python_(programming_language)" --output-folder ./output --format json

Save a specific table by its header (to stdout):

wikiscraperx --url "https://en.wikipedia.org/wiki/Python_(programming_language)" --header "Summary of Python 3's built-in types"

Save as JSON to stdout:

wikiscraperx --url "https://en.wikipedia.org/wiki/Python_(programming_language)" --header "Summary of Python 3's built-in types" --format json

Use Cases

Sports Stats Analysis

Scrape professional records of athletes (e.g., MMA fighters) for analysis:

wikiscraperx --url "https://en.wikipedia.org/wiki/Khabib_Nurmagomedov" --output-folder ./fighters/khabib --format json

Climate Data Collection

Extract historical weather and climate data tables for specific regions:

wikiscraperx --url "https://en.wikipedia.org/wiki/Climate_of_London" --output-folder ./weather/london --format csv

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

wikiscraperx-1.0.6.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

wikiscraperx-1.0.6-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file wikiscraperx-1.0.6.tar.gz.

File metadata

  • Download URL: wikiscraperx-1.0.6.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for wikiscraperx-1.0.6.tar.gz
Algorithm Hash digest
SHA256 8ad34629645cea25a96abaf3a7f9217a0cda4f25bd8ed16b6e7f2b87d6eaff58
MD5 17152a5190a83d417120078f7bf48a21
BLAKE2b-256 8be0fe1323372e97444d79551297fbc358399e46fdc9eabe68f5ef1154901d62

See more details on using hashes here.

File details

Details for the file wikiscraperx-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: wikiscraperx-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for wikiscraperx-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ae71f87e6f5a292efcae2d6b6a3583f9ba98869a685cacae9b9dfd550db39979
MD5 30a5fc3e0aa5e9067f7dce3a4b825cd0
BLAKE2b-256 d72aac6fd5e93f8251bb717f56316a2e039b8c0f2631673a332317b312b537c7

See more details on using hashes here.

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