@stormking/emere
v2.0.1
Published
a nightmarejs replacement for scraping websites using electron.
Downloads
3
Maintainers
Readme
Emere
Small tool to retrieve HTML or PDF from a loaded webpage with electron.
Works as a minimal replacement for nightmare.js since it hasn't been getting updates for years.
Usage
See src/main.test.ts for more examples.
import run from 'emere';
let bufferWithHtml = await run({
url: 'http://example.org',
waitForSelector: 'h1'
});
Options API
type RunScript = {
url: string, //webpage to call
header?: Record<string, string|string[]>, //headers to send when loading
body?: string, //request body to send
method?: string, //HTTP method to use
referrer?: string, //HTTP referrer to set
waitAfterLoad?: number, //wait for ms before grabbing the page. still respects timeout
waitForSelector?: string, //wait up to the timeout until this element appears on the page
userAgent?: string, //user-agent to set
timeout?: number, //timeout for the whole process. will kill electron process
get?: 'html'|'pdf' //defaults to html when not set
}