Skip to content

Latest commit

 

History

History
50 lines (30 loc) · 1.23 KB

File metadata and controls

50 lines (30 loc) · 1.23 KB

free-google-translate-with-puppeteer

spins up a puppeteer instance (with mega-scraper) and translates any text for free using google translate, headlessly, with a free random proxy (using get-free-https-proxy)

cli usage

npm i -g free-google-translate-with-puppeteer
free-google-translate-with-puppeteer --text 'hello how are you' --to 'de'

cli options

--text [text] (required)

the text to translate

--to [language] (default: en)

translate given text to the following language

--from [language] (default: auto)

translate given text from given language

alternatively with npx

npx free-google-translate-with-puppeteer --text 'hello how are you' --to 'de'

example usage

npm i free-google-translate-with-puppeteer

see example.js

const translate = require('free-google-translate-with-puppeteer')

translate({ text: 'ein apfel am tag hält den arzt fern', from: 'it', to: 'en' })
  .then(translation => {
    console.log(`-> "${translation}"`) // one apple a day keeps the doctor away
  })