reader README

The project's README from github.com/jina-ai/reader. As one markdown file: README.md.

Reader

codecov Ask DeepWiki

Your LLMs deserve better input.

Reader does two things:

Check out the live demo

Or just visit these URLs (Read) https://r.jina.ai/https://github.com/jina-ai/reader, (Search) https://s.jina.ai/Who%20will%20win%202024%20US%20presidential%20election%3F and see yourself.

Feel free to use Reader API in production. It is free, stable and scalable. We are maintaining it actively as one of the core products of Jina AI. Check out rate limit

image image

This repository is the open source branch of the codebase behind https://r.jina.ai and https://s.jina.ai. It runs in stateless or bucket-cached mode; the MongoDB-backed SaaS storage layer is not included here.

Updates

What Reader can read

Usage

Using r.jina.ai for single URL fetching

Simply prepend https://r.jina.ai/ to any URL. For example, to convert the URL https://en.wikipedia.org/wiki/Artificial_intelligence to an LLM-friendly input, use the following URL:

https://r.jina.ai/https://en.wikipedia.org/wiki/Artificial_intelligence

Using r.jina.ai for a full website fetching (Google Colab)

Simply prepend https://s.jina.ai/ to your search query. Note that if you are using this in the code, make sure to encode your search query first, e.g. if your query is Who will win 2024 US presidential election? then your url should look like:

https://s.jina.ai/Who%20will%20win%202024%20US%20presidential%20election%3F

Behind the scenes, Reader searches the web, fetches the top 5 results, visits each URL, and applies r.jina.ai to it. This is different from many web search function-calling in agent/RAG frameworks, which often return only the title, URL, and description provided by the search engine API. If you want to read one result more deeply, you have to fetch the content yourself from that URL. With Reader, http://s.jina.ai automatically fetches the content from the top 5 search result URLs for you (reusing the tech stack behind http://r.jina.ai). This means you don't have to handle browser rendering, blocking, or any issues related to JavaScript and CSS yourself.

Simply specify site in the query parameters such as:

curl 'https://s.jina.ai/When%20was%20Jina%20AI%20founded%3F?site=jina.ai&site=github.com'

Interactive Code Snippet Builder

We highly recommend using the code builder to explore different parameter combinations of the Reader API.

image

Using request headers

You can control the behavior of the Reader API using request headers. The list below covers the most useful ones — for the full surface with up-to-date defaults and validation rules, see the live API docs at https://r.jina.ai/docs, or the source of truth in src/dto/crawler-options.ts.

Using r.jina.ai for single page application (SPA) fetching

Many websites nowadays rely on JavaScript frameworks and client-side rendering, usually known as Single Page Applications (SPA). Thanks to Puppeteer and headless Chrome, Reader natively supports fetching these websites. However, due to specific approaches some SPAs are developed with, there may be some extra precautions to take.

SPAs with hash-based routing

By definition of the web standards, content after # in a URL is not sent to the server. To mitigate this, use POST with the url parameter in the body:

curl -X POST 'https://r.jina.ai/' -d 'url=https://example.com/#/route'

SPAs with preloading contents

Some SPAs (and even some non-SPAs) show preload content before later loading the main content dynamically. In this case, Reader may capture the preload content instead. Two ways to mitigate:

# wait for network idle or until timeout
curl 'https://r.jina.ai/https://example.com/' -H 'x-timeout: 10'

# wait for a specific element
curl 'https://r.jina.ai/https://example.com/' -H 'x-wait-for-selector: #content'

# combined use of both to wait for non-existent element (which means waiting for the full timeout duration)
curl 'https://r.jina.ai/https://example.com/' -H 'x-timeout: 30' -H 'x-wait-for-selector: non-existent-element'

JSON mode

Use the accept-header to control the output format:

curl -H "Accept: application/json" https://r.jina.ai/https://en.m.wikipedia.org/wiki/Main_Page

Generated alt

All images on a page that lack an alt tag can be auto-captioned by a VLM (vision-language model) and formatted as ![Image [idx]: [VLM_caption]](img_URL). This should give your downstream text-only LLM just enough hints to include those images in reasoning, selection, and summarization:

curl -H "X-With-Generated-Alt: true" https://r.jina.ai/https://en.m.wikipedia.org/wiki/Main_Page

Cookbooks

For pipeline-specific recipes — RAG, semantic indexing, deep research, agentic browsing, visual snapshots, PDF/Office/HTML uploads, and more — see cookbooks.md. Each entry is a short curl example with the header combination that fits the use case and a paragraph explaining the trade-offs.

Self-host with Docker

A prebuilt image of the open-source branch is published to GitHub Container Registry. It bundles headless Chrome, LibreOffice, and CJK fonts, so you can run Reader without building it yourself.

docker pull ghcr.io/jina-ai/reader:oss

Run

The image exposes two ports:

For a quick try-out from curl or a browser, map the HTTP/1.1 port:

docker run --rm -p 3000:8081 ghcr.io/jina-ai/reader:oss
# then: curl http://localhost:3000/https://example.com

For load-testing or production-shape traffic, map the h2c port instead (or both):

docker run --rm -p 3000:8080 -p 3001:8081 ghcr.io/jina-ai/reader:oss

With no extra config the container is fully stateless — every request hits the live URL, no cache, no rate limiting. That's the right default for a quick try-out, CI, or throwaway environments.

Run with caching

Point Reader at an S3-compatible bucket to cache fetched pages and reuse them across requests:

docker run --rm -p 3000:8081 \
  -e GCP_STORAGE_ENDPOINT=https://s3.example.com \
  -e GCP_STORAGE_BUCKET=reader-cache \
  -e GCP_STORAGE_ACCESS_KEY=... \
  -e GCP_STORAGE_SECRET_KEY=... \
  ghcr.io/jina-ai/reader:oss

See CONTRIBUTING.md for the full env-var table.

Local development

Requirements:

git clone [email protected]:jina-ai/reader.git
cd reader
npm install
# Optional, for bucket-cached mode:
docker compose up -d

Then either press F5 in VSCode to launch the debugger, or after setting up the appropriate environment variables:

npm run dev

For a deeper tour of the codebase — engines, formatting profiles, abuse alleviation, deployment topology — see architecture.md. For dev workflow, env vars, and tests, see CONTRIBUTING.md.

Licensed assets

A few non-redistributable artifacts live in licensed/ and are needed at build/runtime:

Fetch them in one shot:

npm run assets:download

The script (download-external-assets.sh) is idempotent — it skips files already present and exits 0 even on partial network failure. Set FORCE_DOWNLOAD_EXTERNAL=1 to overwrite, or SKIP_DOWNLOAD_EXTERNAL=1 to bypass entirely if you supply your own copies. The repo's CI fetches the same URLs inline; this script exists for local convenience.

How it works

Ask DeepWiki

Having trouble on some websites?

Some sites push back against scrapers — bot challenges, geo blocks, stale CDN edges. A few knobs to try, in roughly increasing order of "this is bothering me":

If none of those help, please open an issue with the URL and the headers you tried — we'll take a look.

License

Reader is backed by Jina AI and licensed under Apache-2.0.

reader (jina-ai/reader)

Searching Database…

12.2K ·GitHub
这是什么?Reader 是一项服务,只需在任意网址前加上 https://r.jina.ai/,就能把该网页转换为干净、适合大语言模型处理的 Markdown 格式。它还提供网页搜索接口 https://s.jina.ai/,返回排名靠前的搜索结果的可读正文,而不只是标题和摘要。
这是托管的 API,还是我需要自己运行服务器?你可以直接在网址前加上前缀,使用免费的托管 API;也可以使用预构建的 Docker 镜像,自行部署开源版本。
我该怎么用?在任意网址前加上 https://r.jina.ai/,即可获得该网页的 Markdown 版本;或者在(经过 URL 编码的)搜索词前加上 https://s.jina.ai/,即可获取搜索结果并转换为 Markdown。
使用时需要 API 密钥吗?不需要,基础用法免费且无需密钥,但匿名请求的速率限制最低;申请 API 密钥后可解锁更高的配额以及代理池等额外功能。
它能在所有网站上都顺利工作吗?不一定。有些网站会设置机器人验证、地域封锁,或者 CDN 缓存过期,导致无法访问。为此,Reader 提供了一些选项,例如绕过缓存、强制使用浏览器引擎,或通过代理访问,以帮助突破这些限制。
我可以自己部署,而不依赖公共 API 吗?可以。Docker 镜像内置了无头 Chrome、LibreOffice 和中日韩字体,可以独立运行。默认情况下它是无状态的,你也可以通过 docker compose 选择启用 S3/MinIO 存储桶缓存。
除了网页,Reader 还能读取哪些文件类型?它可以通过 PDF.js 读取 PDF 文件,通过 LibreOffice 转换 MS Office 文档(Word、Excel、PowerPoint),还能读取图片。图片会由视觉语言模型生成描述文字,使纯文本的大语言模型也能对其进行推理。
Reader 的搜索与一般的网页搜索 API 有何不同?大多数搜索 API 只返回标题、网址和摘要,而 s.jina.ai 会自动抓取排名前 5 的搜索结果页面,并将其完整转换为 Markdown 内容。
我能控制输出格式和分块方式吗?可以。你可以通过 x-markdown-chunking 等请求头,要求输出 Markdown、JSON 或按语义分块的结果(基于标题或结构层级),还可以精细控制链接和图片的渲染方式。
为什么开源版本不包含 SaaS 存储层?开源分支去掉了 Jina 托管 SaaS 所使用的 MongoDB 存储层,默认以无状态方式运行。对于只想要缓存、又不需要完整 SaaS 后端的自托管用户,则可以选择启用 S3/MinIO 存储桶缓存。
Creator
jina-ai
Size
1.5 MB
Stars
12.2K
Updated
CommitMay 22
Age
2y
Commits · 90 Days