项目作者: shimohq

项目描述 :
🤖 Puppeteer as a Service
高级语言: TypeScript
项目地址: git://github.com/shimohq/finch.git
创建时间: 2018-11-18T15:52:00Z
项目社区:https://github.com/shimohq/finch

开源协议:MIT License

下载


Finch

🤖 Puppeteer as a Service

Features

  • Optimized for cold start by introducing a browser pool
  • Emoji friendly! ❤️
  • Google Noto Font is used, so no more “tofu”s!
  • Resources will be carefully reclaimed to avoid any leakings in a long run
  • We love Docker
  • Easy to use and approachable if you’ve used Puppeteer before

How to use

A Dockerfile is provided for setting up Finch easier:

  1. docker build -t finch .
  2. docker run -p 9001:9001 finch

A Puppeteer cluster will be listening to the port 9001 for you to use as native Puppeteer:

  1. // Replace puppeteer.launch with puppeteer.connect
  2. const browser = await puppeteer.connect({
  3. browserWSEndpoint: 'ws://127.0.0.1:9001/'
  4. });
  5. // Everything else stays the same
  6. const page = await browser.newPage();
  7. await page.goto('https://example.com/');
  8. await page.screenshot({ path: 'screenshot.png' });
  9. browser.close();