sunnyportal-scraper
v1.0.11
Published
Scrapes the Sunnyportal using headless chromium.
Downloads
9
Readme
Sunnyportal Scraper
NodeJS library to retrieve information on PV plants from the Sunnyportal.
Documentation can be found here.
An example file is included here
Usage
Import the library and instantiate a new Scraper.
const Scraper = require("sunnyportal-scraper");
const scraper = new Scraper('username', 'password');
Parameters for all operations can be found in the docs.
Setup the scraper. This operation is asynchronous.
await scraper.setup(false);
Additional parameters can be specified, especially if chromium doesnt run. Refer to puppeteer troubleshooting.
await scraper.setup(false, ['--no-sandbox', '--disable-setuid-sandbox']);
To start the loop that updates the data:
await scraper.start();
// Retrieve data
let data = scraper.getData();
After your application has finished, close the browser instance
await scraper.destroy();
Tests
Tests can be run using Mocha. Username and password have to be provided using environment variables.
SUNNY_USER = username
SUNNY_PASS = password