Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
vasilevich committed Jun 3, 2023
1 parent 484af3c commit 2e2bdc3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ async function translate({text, from = 'auto', to = 'en', browser, page} = {}) {
if (!text) throw new Error('missing text')
if (!from) throw new Error('missing from')
if (!to) throw new Error('missing to')
if (!browser) browser = await createBrowser({headless: false, screenshot: true})
if (!browser) browser = await createBrowser({headless: true, screenshot: true})

page = page || await browser.newPage()
await page.goto(`https://translate.google.com/?op=translate&sl=${from}&tl=${to}&text=${encodeURIComponent(text)}`)
Expand Down

0 comments on commit 2e2bdc3

Please sign in to comment.