Headless browser automation service for things that we can't do with official APIs. Uses puppeter and chrome for browser automation.
- like youtube videos
- add youtube videos to watch later
You can install package via npm or use a docker image
- nodejs >=16
- google chrome or chromium
npm install -g @xtruder/browserboi
browserboi serve --headless --youtube-cookies cookies.json --token <optional auto token>
Starts a headless API on localhost:8080
protected by bearer auth with provided token
docker run \
-e BROWSERBOI_HEADLESS=true \
-e BROWSERBOI_YOUTUBE_COOKIES=/app/cookies.json \
-e BROWSERBOI_TOKEN=<my secret token> \
-p 8080:8080 \
-v $PWD/cookies.json:/app/cookies.json \
ghcr.io/xtruder/browserboi:latest serve
Swagger API documentation is avalible on http://localhost:8080/docs.
Example API call:
curl -XPOST localhost:8080/api/youtube/watchLater \
-H 'Authorization: Bearer <auth token>'
-d '{"url": "https://www.youtube.com/watch?v=gCJxvpo0dxY", "added": true}'
browserboi login-youtube --chrome-path chromium --output cookies.json
This will open chromium with login screen, after you login it will
dump cookies to cookies.json
-
Install google chrome or chromium
-
Clone and install dependencies
git clone https://github.com/xtruder/browserboi.git npm install
-
Obtain youtube access tokens
browserboi login-youtube --chrome-path chromium --output cookies.json
-
npm run dev
This will start a chrome and development server on
localhost:8080
This project already provides vscode development container that will start wayland rdp server, to which you can connect and visually debug your automation.
To connect to rdp server you need to first expose port 3389 from container usng vscode and then use any rdp client to connect to it.
- Bump a version
npm version <major/minor/patch/>
git push --tags
- Release a new version via github
Jaka Hudoklin jaka@x-truder.net @offlinehacker