Headless browser automation service for things that we can't do with official APIs. Uses puppeter and chrome for browser automation.
Browserboi is a service that provides browser automation using puppeteer and exposes http API for various tasks that are not exposed via official apis.
- like youtube videos
- add youtube videos to watch later list
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
This will Start a http API on localhost:8080
.
To obtain cookies.json
you should run:
browserboi login-youtube --chrome-path chromium --output cookies.json
This will open chromium with google login screen, after you login it will dump cookies to cookies.json
, which you can start a service.
docker run \
-e BROWSERBOI_HEADLESS=true \
-e BROWSERBOI_YOUTUBE_COOKIES=/app/cookies.json \
-e BROWSERBOI_TOKEN=<my secret bearer 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 calls:
Adds youtube video to watch later list:
curl -XPOST localhost:8080/api/youtube/watchLater \
-H 'Authorization: Bearer <auth token>'
-d '{"url": "https://www.youtube.com/watch?v=gCJxvpo0dxY", "added": true}'
Like youtube video:
curl -XPOST localhost:8080/api/youtube/likeVideo \
-H 'Authorization: Bearer <auth token>'
-d '{"url": "https://www.youtube.com/watch?v=gCJxvpo0dxY", "liked": true}'
-
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 origin --tags
- Release a new version via github
Jaka Hudoklin [email protected] @offlinehacker