1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Deno DeployでPuppeteerを動かす【Browserless】

Posted at

URLにアクセスするだけでPuppeteerを動かせます

image.png

import { serve } from "https://deno.land/std@0.177.0/http/server.ts"
import puppeteer from "https://deno.land/x/puppeteer@9.0.0/mod.ts"

serve(async (req: Request) => {
    const browser = await puppeteer.connect({ browserWSEndpoint: 'wss://chrome.browserless.io?token=YOUR_TOKEN' })
    const page = await browser.newPage()
    await page.goto('https://www.yahoo.co.jp/')
    return new Response(await page.screenshot())
})

tokenの作り方

下記からtokenをつくりましょう

image.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?