x-search

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

X Search

X(原Twitter)帖子搜索

Search X (Twitter) posts using xAI's Grok API with keyword search, semantic search, user filtering, and date range capabilities.
借助关键词搜索、语义搜索、用户筛选和日期范围功能,使用xAI的Grok API搜索X(原Twitter)帖子。

Instructions for Agents

Agent使用说明

When invoking this skill:
  1. Execute the script using the Bash tool with appropriate parameters based on the user's request
  2. Parse the output which contains both the analysis and citations sections
  3. CRITICAL: Always include the citations in your response to the user. The script output contains a "Citations:" section with numbered X post URLs that MUST be presented to the user
  4. Format your response to include:
    • The analysis/findings from Grok
    • The complete citations list with all referenced post URLs
The script will return formatted output with citations. You MUST include these citations in your response to the user.
调用此技能时:
  1. 执行脚本:根据用户请求,使用Bash工具并传入合适的参数
  2. 解析输出:输出内容包含分析和引用两部分
  3. 重要提示:在给用户的回复中必须包含引用内容。脚本输出的“Citations:”部分包含带编号的X帖子URL,必须展示给用户
  4. 回复格式要求:需包含以下内容:
    • Grok生成的分析/发现结果
    • 包含所有引用帖子URL的完整引用列表

Quick Start

快速入门

Basic X search:
bash
scripts/x_search.sh "What are people saying about AI?"
基础X搜索:
bash
scripts/x_search.sh "What are people saying about AI?"

Environment Setup

环境配置

Required environment variables:
  • XAI_API_KEY
    : Your xAI API key (required)
  • XAI_API_HOST
    : API host URL (optional, defaults to https://api.x.ai)
所需环境变量:
  • XAI_API_KEY
    : 你的xAI API密钥(必填)
  • XAI_API_HOST
    : API主机地址(可选,默认值为https://api.x.ai)

Search Options

搜索选项

Date Range Filtering

日期范围筛选

Restrict search to specific time period:
bash
scripts/x_search.sh "AI developments" --from-date 2025-01-01 --to-date 2025-02-06
将搜索限制在特定时间段:
bash
scripts/x_search.sh "AI developments" --from-date 2025-01-01 --to-date 2025-02-06

User Handle Filtering

用户账号筛选

Search only specific users (max 10):
bash
scripts/x_search.sh "latest updates" --allowed-handles elonmusk,gdb
Exclude specific users (max 10):
bash
scripts/x_search.sh "tech news" --excluded-handles spamaccount,bot123
Note: Cannot use both
--allowed-handles
and
--excluded-handles
in the same request.
仅搜索特定用户的帖子(最多10个):
bash
scripts/x_search.sh "latest updates" --allowed-handles elonmusk,gdb
排除特定用户的帖子(最多10个):
bash
scripts/x_search.sh "tech news" --excluded-handles spamaccount,bot123
注意:同一请求中不能同时使用
--allowed-handles
--excluded-handles
参数。

Media Understanding

媒体内容识别

Enable image analysis in posts:
bash
scripts/x_search.sh "AI art trends" --enable-images
Enable video analysis in posts:
bash
scripts/x_search.sh "product demos" --enable-videos
启用帖子中的图片分析:
bash
scripts/x_search.sh "AI art trends" --enable-images
启用帖子中的视频分析:
bash
scripts/x_search.sh "product demos" --enable-videos

Combined Options

组合选项

All options can be combined:
bash
scripts/x_search.sh "climate change discussion" \
  --from-date 2025-01-01 \
  --excluded-handles climateskeptic \
  --enable-images
所有选项可以组合使用:
bash
scripts/x_search.sh "climate change discussion" \
  --from-date 2025-01-01 \
  --excluded-handles climateskeptic \
  --enable-images

Enable Reasoning Model

启用推理模型

Use
--thinking
flag to switch to the reasoning model for deeper analysis:
bash
scripts/x_search.sh "complex topic requiring deep analysis" --thinking
This uses
grok-4-1-fast-reasoning
instead of the default
grok-4-1-fast-non-reasoning
.
使用
--thinking
参数切换到推理模型以进行深度分析:
bash
scripts/x_search.sh "complex topic requiring deep analysis" --thinking
该模式使用
grok-4-1-fast-reasoning
模型,而非默认的
grok-4-1-fast-non-reasoning
模型。

Output Format

输出格式

The script automatically parses the JSON response and outputs:
  1. Text content: Grok's formatted analysis and findings
  2. Citations: List of X post URLs with reference numbers
Example output:
undefined
脚本会自动解析JSON响应并输出以下内容:
  1. 文本内容:Grok生成的格式化分析和发现结果
  2. 引用列表:带引用编号的X帖子URL列表
输出示例:
undefined

Response:

Response:

[Analysis text with inline citation markers]
[Analysis text with inline citation markers]

Citations:

Citations:

Usage Notes

使用注意事项

  • Default model:
    grok-4-1-fast-non-reasoning
    for fast search responses
  • With
    --thinking
    flag:
    grok-4-1-fast-reasoning
    for deeper reasoning
  • The script uses curl to query the xAI Responses API endpoint
  • Output is automatically parsed with jq for readability
  • Date format: ISO8601 (YYYY-MM-DD)
  • Handle limits: 10 maximum for allowed/excluded lists
  • 默认模型:
    grok-4-1-fast-non-reasoning
    ,用于快速搜索响应
  • 启用
    --thinking
    参数时:使用
    grok-4-1-fast-reasoning
    进行深度推理
  • 脚本使用curl调用xAI Responses API接口
  • 输出会自动通过jq解析以提升可读性
  • 日期格式:ISO8601(YYYY-MM-DD)
  • 账号数量限制:允许/排除的用户账号列表最多10个