An URL reader like jina-ai/reader for AI Agents which can be deployed very easily as a Cloudflare Worker.
IMPORTANT: You need Worker Paid plan to use this worker due to the limitation of Browser ability.
npm run deploy:allThis deploys the private url-reader-parser Worker first, then the public reader Worker. Wrangler also provisions the KV namespace and Durable Object binding declared in wrangler.jsonc.
[YOUR_WORKER_URL]?target={targetUrl}&mode={mode}&retain_media={retainMedia}&auth_key={authKey}
-
targetUrl: URL of the target page, read image / audio / video directly is not supported. -
mode(optional):markdownreturns readable Markdown,textreturns plain text,get_responsestreams the origin response without browser rendering, and any other value returns cleaned rendered HTML. -
retainMedia(optional): Controls how<video>,<audio>, and supported video embeds appear in Markdown. Supported values arelink(default),text,image,html, andnone. Media and image URLs are resolved against the page URL, including lazy-loadedsrcsetanddata-srcvalues. -
authKey(optional): IfAUTH_KEYset, you need to pass the key in the query. We recommend to use Cloudflare's abilities to protect your worker.
CACHE_CONTROL: Response cache control which follows Cloudflare's rules.BROWSER_TIMEOUT: General timeout for puppeteer.BROWSER_KEEP_ALIVE: Browser session inactivity timeout in milliseconds, up to 10 minutes.FETCH_CACHE_TTL: General ttl for caching HEAD and GET requests to original content.BROWSER_USER_AGENT: User-Agent string for puppeteer.SALVAGE_USER_AGENT: User-Agent string for salvage fetching.AUTH_KEY: An optional access key. Set production values withwrangler secret put AUTH_KEY; do not commit them towrangler.jsonc.
npm test
npm run typecheck
npm run checkPlease using WAF / Rules on Cloudflare to secure your worker because it can access any url from any source by default, THIS WORKER CAN BE ABUSED POTENTIALLY.
If you want to add some extra logic to block some evil requests, please fork it and modify the code.
Apache-2.0