/kplc-bill-scraper

KPLC Electricity Bill Scraper built using Puppeteer

Primary LanguageJavaScriptMIT LicenseMIT

KPLC Bill Scraper

This is a scraper built with Puppeteer to fetch past electricity bills from the Kenya Power and Lighting Company (KPLC) website. I wrote a story about on how i built this here and why i built it here.

Usage

  1. Clone the repo
git clone https://github.com/username/kplc-bill-scraper.git
  1. Install Dependencies
npm install
  1. Replace with your Meter No in index.js
// INSERT METER NO Here
startScraping("YOUR_METER_NO");
  1. Run the Script
node index.js

This will navigate to the Bill/Meter Query Page, key in your meter no , execute the query on the page and return the result on the network tab.

Customizing

The scraper can be easily customized to change the meter no. You can also change the button id to choose Account No for Post Paid results in index.js

  // Radio Item Account No radio-1097
  // Radio Item Meter No radio-1098
  await page.click("#radio-1098");

Troubleshooting

If the scraper does not return the results, update the code to fit the workflow by using the newly generated html element ids(if they change).

Disclaimer

This project is for educational/testing purposes only. Use at your own risk.

This project is not affiliated with or endorsed by the Kenya Power and Lighting Company. The creators have no intention of causing harm or prejudice against KPLC. This is an independent project meant for learning purposes only.

License

This project is licensed under the MIT License. See LICENSE for more details