HUB
Sign inSign up

vxcontrol/scraper

By vxcontrol

•Updated 1 day ago

Headless Chrome service for PentAGI: page HTML, Markdown, links, screenshots, PDF and live sessions

Image
Security
Machine learning & AI
Developer tools
0

100K+

vxcontrol/scraper repository overview

⁠Scraper: Headless Chrome Service for PentAGI

Discord⠀Telegram
Join the community. Connect with security researchers, AI enthusiasts, and fellow ethical hackers. Get support, share insights, and stay updated with the latest PentAGI developments.

Headless Chrome behind one HTTPS port: page HTML, Markdown, links, screenshots and PDF, plus interactive browser sessions

The browser that PentAGI⁠ agents use to read the web. One container, TLS and Basic Auth included, built for linux/amd64 and linux/arm64.

⁠Quick Start

# Start the service on https://localhost:9443
docker run -d --name scraper -p 9443:443 --shm-size=2g \
  -v scraper-ssl:/usr/src/app/ssl \
  -e USERNAME=someuser -e PASSWORD=somepass \
  vxcontrol/scraper
# Check it: the page as Markdown
curl -k -u someuser:somepass "https://localhost:9443/markdown?url=https://example.com/"
# A screenshot of the whole page
curl -k -u someuser:somepass -o page.png \
  "https://localhost:9443/screenshot?fullPage=true&url=https://example.com/"
  • The certificate is self-signed and is generated on the first start, hence curl -k. The volume keeps it between restarts.
  • Without USERNAME and PASSWORD the API answers without authentication.

⁠Tags

TagBuildAPI
latest, 2Current buildScraper API (v1) and Session API (v2)
1Previous, legacy buildScraper API (v1) only

2 keeps the Scraper API of 1 unchanged: a client written for 1 works with 2 as it is. Stay on 1 only if you need the previous build exactly:

docker pull vxcontrol/scraper:1

⁠API

⁠Scraper API (v1): tags 1, 2, latest

Every call opens the page in a browser of its own, renders it and closes the browser. All routes are GET and take the page address in url.

RouteAnswer
/html?url=...Rendered HTML of the page, text/html
/markdown?url=...The page as Markdown, text/markdown
/links?url=...Links of the page, JSON: [{"title": "...", "link": "..."}]
/screenshot?url=...&fullPage=true&type=pngScreenshot, image/png or image/jpeg (type=jpeg)
/pdf?url=...The page as PDF, application/pdf

In 2 the same routes also answer under /v1, for example /v1/markdown?url=.... A call in 2 is bounded: 55 seconds and SCRAPER_MAX_RESPONSE_BYTES of answer.

⁠Version: tags 2, latest
curl -k -u someuser:somepass https://localhost:9443/version
# {"api":{"scraper":true,"sessions":true},"name":"browserx","version":"..."}

1 has no such route and answers 404, so a client can tell the two builds apart.

⁠Session API (v2): tags 2, latest

A session is a Chrome that stays open: tabs, clicks and typing, files, cookies, the network log and a live view. All routes start with /v2.

RoutePurpose
GET /v2/capabilitiesWhat this service can do and its limits
POST /v2/sessions, GET /v2/sessionsOpen a session, list sessions
GET, DELETE /v2/sessions/{id}Read or close a session
GET, POST /v2/sessions/{id}/tabsList tabs, open a tab
POST .../tabs/{tabId}/activate, DELETE .../tabs/{tabId}Bring a tab to the front, close it
POST .../tabs/{tabId}/navigateOpen an address in the tab
POST .../tabs/{tabId}/actionclick, fill, type, press, select, scroll, wait, dialog, upload, back, forward, reload
GET .../tabs/{tabId}/snapshotElements and text of the page, with references for actions
GET .../tabs/{tabId}/read?format=textThe page as text, html or links
POST .../tabs/{tabId}/find, GET .../tabs/{tabId}/framesFind elements by text, list frames
GET .../tabs/{tabId}/screenshotScreenshot as base64 PNG or JPEG
GET, DELETE .../tabs/{tabId}/network, .../consoleNetwork log and console of the tab
GET, POST, DELETE .../tabs/{tabId}/cookies, .../storage/local, .../storage/sessionCookies and storage
POST .../tabs/{tabId}/evaluateRun JavaScript in the page (BROWSERX_ALLOW_EVALUATE)
POST /v2/sessions/{id}/uploads, GET /v2/sessions/{id}/downloadsFiles for upload fields, files the pages downloaded
WS /v2/sessions/{id}/stream?tabId=...Live view of a tab and input into it

... stands for /v2/sessions/{id}.

BASE=https://localhost:9443
AUTH=someuser:somepass

# Open a session: the answer has "id" and "activeTabId"
curl -k -u $AUTH -X POST -H 'Content-Type: application/json' -d '{}' $BASE/v2/sessions

# Open a page in its tab, read the text, close the session
curl -k -u $AUTH -X POST -H 'Content-Type: application/json' \
  -d '{"url":"https://example.com/"}' $BASE/v2/sessions/<id>/tabs/<tabId>/navigate
curl -k -u $AUTH "$BASE/v2/sessions/<id>/tabs/<tabId>/read?format=text"
curl -k -u $AUTH -X DELETE $BASE/v2/sessions/<id>

A session does not open addresses of the container itself (localhost and other loopback addresses).

⁠Environment Variables

⁠All tags
VariableDefaultMeaning
USERNAME, PASSWORDnot setBasic Auth of the API. Not set: no authentication
MAX_CONCURRENT_SESSIONS10Browsers that run at the same time
USE_SSLtrueServe HTTPS
SERVER_NAMEscraper.local in 1, browserx.local in 2Name in the generated certificate
LISTEN0.0.0.0:443Address and port inside the container
CONNECTION_TIMEOUT60000 in 1, 86400000 in 2Milliseconds a browser connection may live

To use your own certificate, put service.crt and service.key into /usr/src/app/ssl before the first start.

⁠Tags 2, latest
VariableDefaultMeaning
SESSION_MANAGER_URLinside the containerSet it empty to run the Scraper API alone, without /v2
SCRAPER_MAX_RESPONSE_BYTES64 MiBLargest answer of a Scraper API call
BROWSERX_MAX_SESSIONS8Sessions open at the same time
BROWSERX_SESSION_IDLE_TIMEOUT_MS600000A session nobody uses for this long is closed
BROWSERX_MAX_TABS50Tabs in one session
BROWSERX_STEP_TIMEOUT_MS15000Longest single step in a tab; 0 lifts the bound
BROWSERX_ALLOW_EVALUATEtrueAllow evaluate
BROWSERX_ACCEPT_INSECURE_CERTStrueOpen pages with self-signed or expired certificates
BROWSERX_DOWNLOAD_MAX_BYTES, BROWSERX_DOWNLOADS_MAX_BYTES100 MiB, 500 MiBLargest download, and all downloads kept in one session
BROWSERX_UPLOADS_MAX_BYTES500 MiBFiles uploaded in one session
BROWSERX_NETWORK_JOURNAL_BYTES100 MiBMemory of the network log of one session

⁠Docker Compose

services:
  scraper:
    image: vxcontrol/scraper:latest
    restart: unless-stopped
    shm_size: 2g
    ports:
      - 127.0.0.1:9443:443
    environment:
      - MAX_CONCURRENT_SESSIONS=10
      - USERNAME=someuser
      - PASSWORD=somepass
    volumes:
      - scraper-ssl:/usr/src/app/ssl

volumes:
  scraper-ssl:

2 reports its health to Docker (HEALTHCHECK) and stops when one of the Scraper API processes ends, so keep a restart policy.

Tag summary

Content type

Image

Digest

sha256:e975ce425…

Size

1.3 GB

Last updated

1 day ago

docker pull vxcontrol/scraper