jina-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

jina - Web Content Reader & Search

jina - 网页内容读取与搜索

CLI tool for reading web content and performing AI-powered web searches.
一款用于读取网页内容并执行AI驱动网页搜索的CLI工具。

Quick start

快速开始

Install:
bash
curl -fsSL https://raw.githubusercontent.com/geekjourneyx/jina-cli/main/scripts/install.sh | bash
Basic usage:
bash
undefined
安装:
bash
curl -fsSL https://raw.githubusercontent.com/geekjourneyx/jina-cli/main/scripts/install.sh | bash
基础用法:
bash
undefined

Read a URL

读取URL内容

jina read --url "https://example.com"
jina read --url "https://example.com"

Search the web

网页搜索

jina search --query "golang latest news"
undefined
jina search --query "golang latest news"
undefined

Commands

命令列表

CommandPurpose
read
Extract and convert content from URLs to LLM-friendly format
search
Search the web with AI-powered result processing
config
Manage settings (set/get/list/path)
命令用途
read
从URL提取内容并转换为LLM友好的格式
search
通过AI驱动的结果处理进行网页搜索
config
管理设置(设置/获取/列出/路径)

Read command

Read命令

Extract content from any URL:
bash
undefined
从任意URL提取内容:
bash
undefined

Basic read

基础读取

jina read --url "https://example.com"
jina read --url "https://example.com"

Read with image captioning

读取并生成图片说明

jina read -u "https://x.com/user/status/123" --with-alt
jina read -u "https://x.com/user/status/123" --with-alt

Batch process from file

从文件批量处理

jina read --file urls.txt
jina read --file urls.txt

Output as Markdown

输出为Markdown格式

jina read -u "https://example.com" --output markdown
jina read -u "https://example.com" --output markdown

Save to file

保存到文件

jina read -u "https://example.com" --output-file result.md
undefined
jina read -u "https://example.com" --output-file result.md
undefined

Response formats

返回格式

The API can return content in different formats via
--format
:
  • markdown
    - Default, LLM-friendly Markdown
  • html
    - Raw HTML
  • text
    - Plain text
  • screenshot
    - URL to a screenshot
通过
--format
参数,API可返回不同格式的内容:
  • markdown
    - 默认格式,LLM友好的Markdown
  • html
    - 原始HTML
  • text
    - 纯文本
  • screenshot
    - 截图的URL

Advanced options

高级选项

bash
undefined
bash
undefined

Bypass cache

绕过缓存

jina read -u "https://example.com" --no-cache
jina read -u "https://example.com" --no-cache

Use proxy

使用代理

CSS selector extraction

CSS选择器提取

jina read -u "https://example.com" --target-selector "article.main"
jina read -u "https://example.com" --target-selector "article.main"

Wait for element to load

等待元素加载

jina read -u "https://example.com" --wait-for-selector "#content"
jina read -u "https://example.com" --wait-for-selector "#content"

Forward cookies

传递Cookie

jina read -u "https://example.com" --cookie "session=abc123"
jina read -u "https://example.com" --cookie "session=abc123"

POST method for SPA with hash routing

对带哈希路由的SPA使用POST方法

jina read -u "https://example.com/#/route" --post
undefined
jina read -u "https://example.com/#/route" --post
undefined

Search command

Search命令

Search the web with automatic content fetching from top results:
bash
undefined
自动获取顶部搜索结果的内容进行网页搜索:
bash
undefined

Basic search

基础搜索

jina search --query "golang latest news"
jina search --query "golang latest news"

Restrict to specific sites

限制到特定站点

jina search -q "AI developments" --site techcrunch.com --site theverge.com
jina search -q "AI developments" --site techcrunch.com --site theverge.com

Limit results

限制结果数量

jina search -q "climate change" --limit 10
jina search -q "climate change" --limit 10

Output format

输出格式

jina search -q "news" --output markdown
undefined
jina search -q "news" --output markdown
undefined

Site filtering

站点过滤

Use multiple
--site
flags to restrict search to specific domains:
bash
jina search -q "startup funding" --site techcrunch.com --site theverge.com --site wired.com
使用多个
--site
标志将搜索限制到特定域名:
bash
jina search -q "startup funding" --site techcrunch.com --site theverge.com --site wired.com

Configuration

配置

Config file:
~/.jina-reader/config.yaml
Priority: Command args > Environment vars > Config file > Defaults
Environment variables:
  • JINA_API_BASE_URL
    - Read API URL (default:
    https://r.jina.ai/
    )
  • JINA_SEARCH_API_URL
    - Search API URL (default:
    https://s.jina.ai/
    )
  • JINA_TIMEOUT
    - Request timeout in seconds (default:
    30
    )
  • JINA_WITH_GENERATED_ALT
    - Enable image captioning (default:
    false
    )
  • JINA_OUTPUT_FORMAT
    - Output format: json/markdown (default:
    json
    )
  • JINA_PROXY_URL
    - Proxy server URL
Config commands:
bash
undefined
配置文件:
~/.jina-reader/config.yaml
优先级: 命令行参数 > 环境变量 > 配置文件 > 默认值
环境变量:
  • JINA_API_BASE_URL
    - 读取API地址(默认:
    https://r.jina.ai/
  • JINA_SEARCH_API_URL
    - 搜索API地址(默认:
    https://s.jina.ai/
  • JINA_TIMEOUT
    - 请求超时时间(秒,默认:
    30
  • JINA_WITH_GENERATED_ALT
    - 启用图片说明生成(默认:
    false
  • JINA_OUTPUT_FORMAT
    - 输出格式: json/markdown(默认:
    json
  • JINA_PROXY_URL
    - 代理服务器地址
配置命令:
bash
undefined

Set configuration

设置配置项

jina config set timeout 60 jina config set with-generated-alt true
jina config set timeout 60 jina config set with-generated-alt true

View configuration

查看配置

jina config list jina config get timeout jina config path
undefined
jina config list jina config get timeout jina config path
undefined

Output formats

输出格式

JSON format (default, machine-readable):
json
{
  "success": true,
  "data": {
    "url": "https://example.com",
    "content": "# Extracted Content\n\n...",
    "title": "Page Title"
  }
}
Markdown format (human-readable):
bash
jina read -u "https://example.com" --output markdown
JSON格式(默认,机器可读):
json
{
  "success": true,
  "data": {
    "url": "https://example.com",
    "content": "# Extracted Content\n\n...",
    "title": "Page Title"
  }
}
Markdown格式(人类可读):
bash
jina read -u "https://example.com" --output markdown

Common use cases

常见用例

Reading social media posts

读取社交媒体帖子

bash
undefined
bash
undefined

X (Twitter) posts

X(Twitter)帖子

jina read -u "https://x.com/elonmusk/status/123456" --with-alt
jina read -u "https://x.com/elonmusk/status/123456" --with-alt

The --with-alt flag enables VLM image captioning for embedded images

--with-alt标志可为嵌入图片启用VLM图片说明生成

undefined
undefined

Reading articles/blogs

读取文章/博客

bash
undefined
bash
undefined

Standard article

标准文章

With specific format

指定格式

jina read -u "https://example.com" --format text --output markdown
undefined
jina read -u "https://example.com" --format text --output markdown
undefined

Research workflows

研究工作流

bash
undefined
bash
undefined

1. Search for topic

1. 搜索主题

jina search -q "quantum computing 2025" --limit 10
jina search -q "quantum computing 2025" --limit 10

2. Read specific results

2. 读取特定结果

jina read --file search_results.txt
undefined
jina read --file search_results.txt
undefined

Batch processing

批量处理

Create a file with one URL per line:
bash
cat > urls.txt << EOF
https://example.com/page1
https://example.com/page2
https://x.com/user/status/123
EOF

jina read --file urls.txt --output markdown
创建每行一个URL的文件:
bash
cat > urls.txt << EOF
https://example.com/page1
https://example.com/page2
https://x.com/user/status/123
EOF

jina read --file urls.txt --output markdown

Project structure

项目结构

cli/
├── main.go              # Root command
├── read.go              # read command
├── search.go            # search command
├── config.go            # config command
└── pkg/
    ├── api/client.go    # Jina API HTTP client
    ├── config/          # Config file management
    └── output/          # JSON/Markdown formatter
cli/
├── main.go              # 根命令
├── read.go              # read命令
├── search.go            # search命令
├── config.go            # config命令
└── pkg/
    ├── api/client.go    # Jina API HTTP客户端
    ├── config/          # 配置文件管理
    └── output/          # JSON/Markdown格式化工具

Implementation notes

实现说明

  • Go 1.24+ required
  • Zero dependencies except Cobra
  • Single binary distribution
  • Config stored as simple
    key=value
    format (no YAML library dependency)
For API details: See
cli/pkg/api/client.go
  • 需要Go 1.24+
  • 除Cobra外无其他依赖
  • 单二进制分发
  • 配置以简单的
    key=value
    格式存储(无YAML库依赖)
API详情: 参见
cli/pkg/api/client.go