jina-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesejina - 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 | bashBasic usage:
bash
undefined安装:
bash
curl -fsSL https://raw.githubusercontent.com/geekjourneyx/jina-cli/main/scripts/install.sh | bash基础用法:
bash
undefinedRead a URL
读取URL内容
jina read --url "https://example.com"
jina read --url "https://example.com"
Search the web
网页搜索
jina search --query "golang latest news"
undefinedjina search --query "golang latest news"
undefinedCommands
命令列表
| Command | Purpose |
|---|---|
| Extract and convert content from URLs to LLM-friendly format |
| Search the web with AI-powered result processing |
| Manage settings (set/get/list/path) |
| 命令 | 用途 |
|---|---|
| 从URL提取内容并转换为LLM友好的格式 |
| 通过AI驱动的结果处理进行网页搜索 |
| 管理设置(设置/获取/列出/路径) |
Read command
Read命令
Extract content from any URL:
bash
undefined从任意URL提取内容:
bash
undefinedBasic 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
undefinedjina read -u "https://example.com" --output-file result.md
undefinedResponse formats
返回格式
The API can return content in different formats via :
--format- - Default, LLM-friendly Markdown
markdown - - Raw HTML
html - - Plain text
text - - URL to a screenshot
screenshot
通过参数,API可返回不同格式的内容:
--format- - 默认格式,LLM友好的Markdown
markdown - - 原始HTML
html - - 纯文本
text - - 截图的URL
screenshot
Advanced options
高级选项
bash
undefinedbash
undefinedBypass cache
绕过缓存
jina read -u "https://example.com" --no-cache
jina read -u "https://example.com" --no-cache
Use proxy
使用代理
jina read -u "https://example.com" --proxy "http://proxy.com:8080"
jina read -u "https://example.com" --proxy "http://proxy.com:8080"
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
undefinedjina read -u "https://example.com/#/route" --post
undefinedSearch command
Search命令
Search the web with automatic content fetching from top results:
bash
undefined自动获取顶部搜索结果的内容进行网页搜索:
bash
undefinedBasic 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
undefinedjina search -q "news" --output markdown
undefinedSite filtering
站点过滤
Use multiple flags to restrict search to specific domains:
--sitebash
jina search -q "startup funding" --site techcrunch.com --site theverge.com --site wired.com使用多个标志将搜索限制到特定域名:
--sitebash
jina search -q "startup funding" --site techcrunch.com --site theverge.com --site wired.comConfiguration
配置
Config file:
~/.jina-reader/config.yamlPriority: Command args > Environment vars > Config file > Defaults
Environment variables:
- - Read API URL (default:
JINA_API_BASE_URL)https://r.jina.ai/ - - Search API URL (default:
JINA_SEARCH_API_URL)https://s.jina.ai/ - - Request timeout in seconds (default:
JINA_TIMEOUT)30 - - Enable image captioning (default:
JINA_WITH_GENERATED_ALT)false - - Output format: json/markdown (default:
JINA_OUTPUT_FORMAT)json - - Proxy server URL
JINA_PROXY_URL
Config commands:
bash
undefined配置文件:
~/.jina-reader/config.yaml优先级: 命令行参数 > 环境变量 > 配置文件 > 默认值
环境变量:
- - 读取API地址(默认:
JINA_API_BASE_URL)https://r.jina.ai/ - - 搜索API地址(默认:
JINA_SEARCH_API_URL)https://s.jina.ai/ - - 请求超时时间(秒,默认:
JINA_TIMEOUT)30 - - 启用图片说明生成(默认:
JINA_WITH_GENERATED_ALT)false - - 输出格式: json/markdown(默认:
JINA_OUTPUT_FORMAT)json - - 代理服务器地址
JINA_PROXY_URL
配置命令:
bash
undefinedSet 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
undefinedjina config list
jina config get timeout
jina config path
undefinedOutput 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 markdownJSON格式(默认,机器可读):
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 markdownCommon use cases
常见用例
Reading social media posts
读取社交媒体帖子
bash
undefinedbash
undefinedX (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图片说明生成
undefinedundefinedReading articles/blogs
读取文章/博客
bash
undefinedbash
undefinedStandard article
标准文章
jina read -u "https://blog.example.com/article"
jina read -u "https://blog.example.com/article"
With specific format
指定格式
jina read -u "https://example.com" --format text --output markdown
undefinedjina read -u "https://example.com" --format text --output markdown
undefinedResearch workflows
研究工作流
bash
undefinedbash
undefined1. 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
undefinedjina read --file search_results.txt
undefinedBatch 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 markdownProject 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 formattercli/
├── 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 format (no YAML library dependency)
key=value
For API details: See
cli/pkg/api/client.go- 需要Go 1.24+
- 除Cobra外无其他依赖
- 单二进制分发
- 配置以简单的格式存储(无YAML库依赖)
key=value
API详情: 参见
cli/pkg/api/client.go