eleko
a few electron helper functions (mimics puppeteer API) usable inside electron context + node context launch function that spawns an electron child process with an easy to use subset of the same helper functions (mimics puppeteer API)
Easy to use
const eleko = ; { const browser = await eleko const page = await browser page await page await page } const adBlockClient = { return adBlockClient }
Electron usage ( helper functions )
CLICK ME
// this file is run with the electron binary const electron = const eleko = // Module to control application life const app = electronapp // Module to create native browser window const BrowserWindow = electronBrowserWindow app let page { page = await eleko // page.win is an instance of BrowserWindow that is updated // every time page.goto is called. // block ads using a subset of easylist eleko const url = 'https://www.youtube.com/watch?v=Gu2pVPWGYMQ' await page // waitFor string await eleko // evaluate await eleko // get title const title = await eleko console // waitFor function await eleko // evaluate with args ( play video ) await eleko // print video duration periodically { const time = await eleko if time console } } { return adBlockClient } const fs = const path = const adBlockClient = fs
Node usage ( using launch api )
CLICK ME
const electron = const eleko = const fs = const path = { // make sure you have electron installed // npm install --save electron ( tested on 7.1.11 ) const browser = await eleko const page = await browser const userAgent = await page console // cancel or do something before requests page console const url = 'https://www.youtube.com/watch?v=Gu2pVPWGYMQ' await page console const now = Date await page await page const title = await page console console await page await page // print video duration periodically { const time = await page if time console } } const adBlockClient = fs { console return adBlockClient }
About
Simple easy to use api for basic controlling of electron browser.
Why
Electron comes bundled with a nice Chromium version that is capable to play many media formats that default Chromium is unable to that e.g. Puppeteer comes with. But the API for puppeteer is much nicer.
For who?
Those wanting to easy api for basic control of the electron browser. Not intended for scraping.
How
Within electron a set of helper functions to control a BrowserWindow object.
From node using the launch api setup an IPC for a basic api.
Similar
Test
test node context launch api against a local server
npm run test:node
test electron context helper functions against a local server
npm run test:electron
play youtube video test while blocking ads ( requries internet access )
npm run test:youtube
play youtube h264 video ( default chromium can't play these )
npm run test:h264
play youtube av1 video ( some wooly all-codecs chromium builds can't play these )
npm run test:av1
run all tests
npm test