Skip to content

Sparrow0hawk/Leeds-localelc-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scrape Leeds Local Election results page

A CLI tool to scrape the Leeds Local Election results page. Data is published as a tabular file on Data Mill North 2 weeks after the result, but in the meantime you can use this tool to extract the data.

The structure of the final file is aimed to roughly align with the format of the file shared on Data Mill North.R

Set up

  • Python 3.12
  • GNU Make
  1. Create virtual environment
    python3.12 -m venv --prompt . .venv
  2. Install project dependencies
    # activate virtual environment
    . .venv/bin/activate
    
    # install dependencies including dev dependencies
    pip install .[dev]
  3. Run tests
    make test
  4. Run CLI
    election_scraper --url https://www.leeds.gov.uk/your-council/elections/leeds-city-council-election-results
    This writes the data to a results.csv file in your current directory.

The data

The data is available from within the data/ directory.