rishabhrpg / puppeteer-on-termux

Run Puppeteer on termux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Puppeteer on termux

Run Puppeteer on Termux

What is Termux?

Termux is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required. A minimal base system is installed automatically - additional packages are available using the APT package manager.

screenshot

Assumptions

  • You have termux installed and have sufficient permissions
  • You have logged-in as root user
  • You are okay with running Puppeteer inside a container (Alpine)

Gotchas

  • There is no build of Google Chrome available for ARM at this moment, so using chromium instead.
  • Installing chromium on Termux directly requires snap which is another big hurdle so alternatively using alpine distro here.

Install Prerequisites

pkg install proot-distro
proot-distro install alpine
proot-distro login alpine
apk update && apk add --no-cache nmap && \
  echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \
  echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories && \
  apk update && \
  apk add --no-cache \
  chromium
  • Node js v12.14+
  • Yarn v1.22+

Usage

git clone https://github.com/rishabhrpg/puppeteer-on-termux.git
cd puppeteer-on-termux
yarn install
node index.js
  • If you see a message "screenshot saved" then puppeteer is successfully configured to run on termux
  • Use this repo as starting point as it has correct args included to successfully run chromium on termux
  • To view screenshot on your device you can run npx http-server and aceess the screenshot directory from a browser.

References

License

MIT

About

Run Puppeteer on termux


Languages

Language:JavaScript 100.0%