Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/koishijs/koishi-plugin-puppeteer
Browser service | 浏览器服务
https://github.com/koishijs/koishi-plugin-puppeteer
puppeteer
Last synced: about 2 months ago
JSON representation
Browser service | 浏览器服务
- Host: GitHub
- URL: https://github.com/koishijs/koishi-plugin-puppeteer
- Owner: koishijs
- License: mit
- Created: 2022-08-09T19:33:32.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-18T20:20:14.000Z (4 months ago)
- Last Synced: 2024-11-07T05:02:18.823Z (about 2 months ago)
- Topics: puppeteer
- Language: TypeScript
- Homepage: https://puppeteer.koishi.chat
- Size: 125 KB
- Stars: 9
- Watchers: 2
- Forks: 7
- Open Issues: 21
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# koishi-plugin-puppeteer
[![npm](https://img.shields.io/npm/v/koishi-plugin-puppeteer?style=flat-square)](https://www.npmjs.com/package/koishi-plugin-puppeteer)
浏览器 API 服务,可用于网页截图等。
> 注意:为了正常使用这个插件,你首先需要确保你的电脑上已经安装有 Chromium。同时,我们建议你保持 Chromium 和本插件的更新,因为版本不匹配可能会导致本插件无法正常使用。
## 类:Puppeteer
可以通过 `ctx.puppeteer` 访问。
### puppeteer.launch()
- 返回值: `Promise`
启动并连接浏览器。
### puppeteer.close()
- 返回值: `Promise`
关闭浏览器并取消连接。
### puppeteer.page()
- 返回值: `Promise`
创建一个新页面。
### puppeteer.render(content, callback?)
- **content:** `string` 要渲染的 HTML
- **callback:** `(page, next) => Promise` 回调函数
- **page:** `Page` 页面实例
- **next:** `(handle: ElementHandle) => Promise` 渲染函数
- 返回值: `string`渲染一个 HTML 页面。