0.0.4 • Published 5 months ago

sumoguri-js v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Sumoguri

A wrapper for puppeteer to explore complex websites.

Installation

npm install sumoguri

Usage

import { Sumoguri, BrowserTaskFunction } from 'sumoguri'

const sumoguri = new Sumoguri({
  origin: 'http://example.com/',
  puppeteer: {
    headless: false
  }
})

const fetchItems: BrowserTaskFunction<{
  items: string[]
}> = async (browser, { artifact }) => {
  artifact.items = []

  await browser.move('/example', async (page) => {
    await page.action('.list-item', (element) => {
      artifact.items.push(element.text())
    })
  })
}

const main = async () => {
  const { items } = await sumoguri.run(fetchItems)
  console.log('items', items)
}
0.0.4

5 months ago

0.0.2

5 months ago