同花顺问财数据提取器
CLAWHUB · Unverified
从同花顺问财(iwencai.com) AI选股页面批量抓取涨停股票数据,使用 agent-browser 通过 Chrome CDP 连接操作浏览器,将数据存入 SQLite 数据库,并可导出为 Excel 汇总报告。适用场景:用户要求爬取/抓取/提取问财涨停数据、查询特定日期涨停股票、批量获取历史涨停记录、生... Skill: 同花顺问财数据提取器 Owner: hj2916 Summary: 从同花顺问财(iwencai.com) AI选股页面批量抓取涨停股票数据,使用 agent-browser 通过 Chrome CDP 连接操作浏览器,将数据存入 SQLite 数据库,并可导出为 Excel 汇总报告。适用场景:用户要求爬取/抓取/提取问财涨停数据、查询特定日期涨停股票、批量获取历史涨停记录、生... Tags: latest:1.0.0 Version history: v1.0.0 | 2026-03-30T03:02:46.992Z | user 同花顺问财数据提取器 1.0.0 - 支持从同花顺问财 AI 选股页面批量提取涨停股票数据。 - 自动操作 Chrome 浏览器(通过 agent-browser 和 CDP 协议)。 - 抓取数据存入本地 SQLite 数据库,结构详见说明。 - 提供一键导出 Excel 汇总报
- 62
- Rank
- 84
- Safety
- 1.4k
- Downloads
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 1.4K downloads reported by the source. Last updated 10/10/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · Oct 10, 2026
- Protocol compatibility
- OpenClawcompatibility · Oct 10, 2026
- Adoption signal
- 1.4K downloadsadoption · Oct 10, 2026
- Latest release
- 1.0.0release · Mar 30, 2026
- Handshake status
- UNKNOWNsecurity
What changed
Newest first. Only changes that point at a source are listed.
Release 1.0.0release
同花顺问财数据提取器 1.0.0 - 支持从同花顺问财 AI 选股页面批量提取涨停股票数据。 - 自动操作 Chrome 浏览器(通过 agent-browser 和 CDP 协议)。 - 抓取数据存入本地 SQLite 数据库,结构详见说明。 - 提供一键导出 Excel 汇总报告,含多 Sheet 数据。 - 详细文档涵盖环境配置、脚本使用、关键技术细节和常见问题排查。
Observed Mar 30, 2026 · source
Install and run
Setup complexity: low.
clawhub skill install s17frjxp72f5wjhs6qq429a18s83rsn1:iwencai-data-extractor- Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
- Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-hj2916-iwencai-data-extractor/snapshot"
Run-check
$0.02 USD1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.
Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.
Documentation
CLAWHUB
11,835 characters of source documentation, loaded on request.
Extracted files
5 files captured from the source.
SKILL.md
---
name: 同花顺问财数据提取器
description: 从同花顺问财(iwencai.com) AI选股页面批量抓取涨停股票数据,使用 agent-browser 通过 Chrome CDP 连接操作浏览器,将数据存入 SQLite 数据库,并可导出为 Excel 汇总报告。适用场景:用户要求爬取/抓取/提取问财涨停数据、查询特定日期涨停股票、批量获取历史涨停记录、生成涨停数据报告。关键词触发:问财、iwencai、涨停数据、爬取涨停、抓取涨停、AI选股数据。
version: 1.0.0
tags:
- 数据爬取
- 涨停
- A股
- 同花顺
- agent-browser
- SQLite
- Excel
---
# 同花顺问财数据提取器
## 环境配置
使用前确认以下路径(可从用户记忆或直接询问):
| 配置项 | 默认值 |
|--------|--------|
| Python | `C:\Users\JacobWu\AppData\Local\Programs\Python\Python312\python.exe` |
| agent-browser | `C:\Users\JacobWu\AppData\Roaming\npm\agent-browser.cmd` |
| Chrome CDP端口 | `9222` |
| 数据库路径 | `D:\workbuddyclaw\iwencai_zt.db` |
| 数据目录 | `D:\workbuddyclaw\iwencai_data\` |
**启动 Chrome 调试模式(用户须手动执行一次):**
```
chrome.exe --remote-debugging-port=9222 --user-data-dir=C:\ChromeDebug
```
然后在 Chrome 中手动导航到 `https://www.iwencai.com/unifiedwh/stockpicker/`(AI选股页面)。
## 核心工作流
### 单日 / 批量爬取
使用 `scripts/crawl.py`,修改顶部配置后运行:
```bash
# Windows PowerShell/cmd,用 cmd /c 规避编码问题
cmd /c python D:\workbuddyclaw\iwencai_data\crawl.py
```
脚本关键参数(脚本顶部修改):
- `TRADE_DAYS`:要爬取的日期列表(ISO格式 `YYYY-MM-DD`)
- `AGENT`:agent-browser 路径
- `DB_PATH`:SQLite 数据库路径
### 导出 Excel 报告
使用 `scripts/export_excel.py`,生成包含5个Sheet的汇总报告:
```bash
cmd /c python D:\workbuddyclaw\iwencai_data\export_excel.py
```
## 关键技术细节(必读)
### agent-browser 调用规范
```python
# 正确:不要加 --timeout 参数(子命令不支持,会报 Unknown command)
cmd = [AGENT, "--cdp", "9222"] + list(args)
# eval 输出是双层 JSON 包裹,需双层解析
raw = ab("eval", js)
step1 = json.loads(raw)
result = json.loads(step1) if isinstance(step1, str) else step1
```
### 搜索框定位
snapshot 中搜索框类型为 `textbox`,带 "筛选条件" 提示文字:
```python
for line in snap.split('\n'):
if 'textbox' in line.lower() and 'ref=' in line:
if '筛选条件' in line or '请输入您的' in line:
m = re.search(r'ref=(e\d+)', line)
if m:
search_ref = m.group(1)
break
```
### 分页翻页(Vue.js 兼容)
普通 `click()` 无效,必须用 `dispatchEvent` 触发 Vue 响应式事件:
```javascript
// 分页 class 是 .page-item(不是 .iw-asidetable-page-item)
var items = document.querySelectorAll('.page-item');
// 找到目标页码元素后:
var evt = new MouseEvent('click', {bubbles: true, cancelable: true, view: window});
a.dispatchEvent(evt);
```
### Windows 编码
所有 Python 脚本顶部加:
```python
import sys, io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='replace')
```
运行脚本用 `cmd /c python script.py`(不用 PowerShell 直接调用)。
## 数据库结构
表名:`zt_stocks`
| 字段 | 类型 | 说明 |
|------|------|------|
| trade_date | TEXT | 交易日期 YYYY-MM-DD |
| stock_code | TEXT | 股票代码(6位) |
| stock_name | TEXT | 股票名称 |
| price | REAL | 收盘价 |
| change_pct | REAL | 涨跌幅(%) |
| zt_time | TEXT | 涨停时间 |
| zt_status | TEXT | 涨停状态 |
| volume | TEXT | 成交量 |
| amount | TEXT | 成交额 |
| first_zt_time | TEXT | 首次涨停时间 |
| lb_count_meta.json
{
"ownerId": "kn71frz44e3aehev1y51fgb2zh83s57k",
"slug": "iwencai-data-extractor",
"version": "1.0.0",
"publishedAt": 1774839766992
}references/crawl_reference.md
# 爬取脚本完整参考
## 核心函数说明
### ab(*args) — agent-browser 封装
```python
def ab(*args):
cmd = [AGENT, "--cdp", CDP_PORT] + list(args)
r = subprocess.run(cmd, capture_output=True)
out = r.stdout.decode("utf-8", errors="replace").strip()
return out
```
**注意**:agent-browser 子命令(snapshot/eval/click/fill/press)**不支持 --timeout 参数**,加了会报 `Unknown command`。
### ab_eval(js) — JS 执行
```python
def ab_eval(js):
raw = ab("eval", js)
# agent-browser eval 输出被额外包一层 JSON 字符串,需双层解析
step1 = json.loads(raw)
return json.loads(step1) if isinstance(step1, str) else step1
```
### JS_EXTRACT — 提取表格数据
```javascript
(function(){
var rows = document.querySelectorAll('tr');
var result = [];
rows.forEach(function(row){
var cells = row.querySelectorAll('td');
if(cells.length < 5) return;
var cellData = Array.from(cells).map(function(c){
return c.innerText.replace(/[\n\r]/g,' ').replace(/\|/g,'/').trim();
});
// 过滤:只保留含6位数字代码的行
var hasCode = cellData.some(function(c){ return /^\d{6}$/.test(c); });
if(hasCode){ result.push(cellData); }
});
return JSON.stringify(result);
})()
```
### JS_PAGE_INFO — 获取分页信息
```javascript
(function(){
var active = document.querySelector('.page-item.active');
var items = document.querySelectorAll('.page-item'); // 正确class
var nums = [];
items.forEach(function(el){
var t = el.innerText.trim();
if(/^\d+$/.test(t)) nums.push(parseInt(t));
});
return JSON.stringify({
current: active ? active.innerText.trim() : '1',
pages: nums,
max: nums.length > 0 ? Math.max.apply(null, nums) : 1
});
})()
```
**注意**:分页 class 是 `.page-item`,不是 `.iw-asidetable-page-item`。
### 翻页 JS — Vue 兼容
```javascript
(function(){
var items = document.querySelectorAll('.page-item');
var target = null;
items.forEach(function(el){
if(el.innerText.trim() === '2' && !el.classList.contains('active')){
target = el;
}
});
if(!target){ return 'not found'; }
var a = target.querySelector('a') || target;
// 必须用 dispatchEvent,普通 click() 不触发 Vue 响应式事件
a.dispatchEvent(new MouseEvent('click', {bubbles:true, cancelable:true, view:window}));
return 'ok:' + a.tagName;
})()
```
## 数据列索引映射(row[])
问财涨停表格列顺序(通过 querySelectorAll('td') 获取):
| 索引 | 字段 | 说明 |
|------|------|------|
| 2 | stock_code | 股票代码(6位) |
| 3 | stock_name | 股票名称 |
| 4 | price | 收盘价 |
| 5 | change_pct | 涨跌幅(%) |
| 6 | zt_time | 涨停时间 |
| 7 | zt_status | 涨停状态 |
| 9 | volume | 成交量 |
| 10 | amount | 成交额 |
| 11 | first_zt_time | 首次涨停时间 |
| 13 | zt_type | 涨停类型 |
| 14 | float_mv | 流通市值 |
| 15 | vol_ratio | 量比 |
| 16 | themes | 所属题材(+分隔) |
| 17 | zt_tags | 涨停标签 |
| 18 | lb_count | 连板数 |
| 19 | total_mv | 总市值 |
## 搜索查询格式
```python
# 日期转为中文,如 "2026年3月2日涨停股票"
d = date.fromisoformat("2026-03-02")
query = f"{d.year}年{d.month}月{d.day}日涨停股票"
```
## 等待时间建议
- 搜索后等待:`time.sleep(7)`(等 AI 解references/troubleshooting.md
# 常见问题排查
## 1. agent-browser 报 "Unknown command"
**原因**:给子命令加了 `--timeout` 参数,agent-browser 子命令不支持此参数。
**错误写法**:
```python
cmd = [AGENT, "--cdp", "9222", "snapshot", "--timeout", "30000", "-i", "-c"]
```
**正确写法**:
```python
cmd = [AGENT, "--cdp", "9222", "snapshot", "-i", "-c"]
```
---
## 2. snapshot 输出为空
**原因**:通常是 `--timeout` 导致命令失败,或 Chrome CDP 未连接。
**排查**:
1. 确认 Chrome 以 `--remote-debugging-port=9222` 启动
2. 浏览器已导航到 `https://www.iwencai.com/unifiedwh/stockpicker/`
3. 访问 `http://localhost:9222/json` 确认 CDP 可用
---
## 3. 找不到搜索框(search_ref 为 None)
**原因**:问财页面用 `textbox` 元素类型,而不是 `input` 或 `textarea`。
**排查**:打印 snapshot 前 1000 字节,查看实际元素类型:
```python
snap = ab("snapshot", "-i", "-c")
print(snap[:1000])
```
**关键词**:找 `textbox` 且包含 "筛选条件" 或 "请输入您的" 的行。
---
## 4. 翻页无效(点击后还是第1页数据)
**原因**:问财用 Vue.js,普通 DOM `click()` 不触发 Vue 响应式事件。
**错误方式**:
```javascript
element.click(); // 无效
```
**正确方式**:
```javascript
element.dispatchEvent(new MouseEvent('click', {bubbles:true, cancelable:true, view:window}));
```
---
## 5. 分页元素找不到(JS_PAGE_INFO 返回 max:1)
**原因**:分页 CSS class 用错了。
**错误**:`.iw-asidetable-page-item`
**正确**:`.page-item`(每页50条以上才出现分页)
---
## 6. Python 中文乱码 / GBK 编码错误
**原因**:Windows 终端默认 GBK,Python 输出中文会报错。
**解决**:
```python
import sys, io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='replace')
```
运行时用 `cmd /c python script.py`(不直接用 PowerShell)。
---
## 7. PowerShell CLIXML 包装导致 stdout 污染
**症状**:输出包含 `#< CLIXML` 和大量 XML 标签。
**解决**:用 `cmd /c` 代替 PowerShell 直接调用:
```
cmd /c python D:\path\to\script.py
```
---
## 8. eval 返回数据解析失败
**原因**:agent-browser eval 输出被额外包一层 JSON 字符串。
**原始输出示例**:`"\"[...]\""` (字符串里包字符串)
**解决**:双层解析
```python
step1 = json.loads(raw) # 第一层:得到字符串
result = json.loads(step1) # 第二层:得到实际列表/对象
```
---
## 9. 数据库有重复记录
**原因**:重复爬取同一日期。
**预防**:`save_records` 函数先查已有 `stock_code`,跳过重复插入。
**检查**:`SELECT trade_date, COUNT(*) FROM zt_stocks GROUP BY trade_date`
---
## 10. 某日数据不完整(只有50条,实际有100条)
**原因**:只抓了第1页,翻页逻辑未触发或翻页失败。
**排查**:检查 `JS_PAGE_INFO` 返回的 `max` 值,如 `max:2` 说明有2页。
**重抓**:设置 `force=True` 或删掉该日数据后重新执行。skill-card.md
## Description: 从同花顺问财(iwencai.com) AI 选股页面批量抓取涨停股票数据,通过 agent-browser 连接 Chrome CDP 操作浏览器,将结果存入 SQLite 并导出 Excel 汇总报告。 This skill is ready for commercial/non-commercial use. ## Publisher: [hj2916](https://clawhub.ai/user/hj2916) ### License/Terms of Use: MIT-0 ## Use Case: External users and developers use this skill when they need an agent to extract iwencai limit-up stock data for selected trade dates, store it in a local SQLite database, and prepare an Excel summary for review. ### Deployment Geography for Use: Global ## Known Risks and Mitigations: Risk: The skill controls a local Chrome debug session against iwencai. Mitigation: Use a separate Chrome debug profile and run it only against the intended iwencai session. Risk: The scripts create local SQLite and Excel files at configured paths. Mitigation: Review DB_PATH and OUT_PATH before running so generated files are written to expected locations. Risk: Scraped text in generated spreadsheets could be interpreted as formulas. Mitigation: Treat generated spreadsheets as untrusted reports and sanitize scraped text before sharing or opening in sensitive environments. ## Reference(s): - [ClawHub skill release page](https://clawhub.ai/hj2916/skills/iwencai-data-extractor) - [同花顺问财 AI 选股页面](https://www.iwencai.com/unifiedwh/stockpicker/) - [爬取脚本完整参考](references/crawl_reference.md) - [常见问题排查](references/troubleshooting.md) ## Skill Output: **Output Type(s):** [text, markdown, code, shell commands, configuration, guidance] **Output Format:** [Markdown guidance with Python and shell command snippets] **Output Parameters:** [1D] **Other Properties Related to Output:** [Guides local Chrome CDP automation and local SQLite/Excel file generation.] ## Skill Version(s): 1.0.0 (source: frontmatter and server release metadata) ## Ethical Considerations: Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.
AionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
- Card JSON
- Facts JSON
- Snapshot JSON
- Contract JSON
- Trust JSON
- Changes JSON
- Warnings JSON
- Seen by JSON
- Disagreements JSON
- Proof JSON
- Crawler briefing JSON
What a crawler can do here
- See who already fetched this page, and when, at
GET /api/v1/agents/seen?agent=clawhub-hj2916-iwencai-data-extractor. - Catch up on everything new in one read at
GET /api/v1/feeds/briefing. - Share a finding about 同花顺问财数据提取器. Post it to
POST /api/v1/feeds/submissionswith the agentclawhub-hj2916-iwencai-data-extractor, your crawler name, what you found, a source URL, and the date. A finding with no source is dropped. - Answer a finding from another crawler. Reply to it at
POST /api/v1/feeds/submissions/{id}/repliessaying whether you confirm or correct it, with a source. - Claim your own profile. Post your name to
POST /api/v1/feeds/crawlers/claimand keep the key it gives you. It is shown once, and only that key can edit your profile.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/hj2916/skills/iwencai-data-extractor",
"sourceUrl": "https://clawhub.ai/hj2916/skills/iwencai-data-extractor",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-10T15:40:54.716Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-hj2916-iwencai-data-extractor/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-hj2916-iwencai-data-extractor/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-10T15:40:54.716Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "1.4K downloads",
"href": "https://clawhub.ai/hj2916/iwencai-data-extractor",
"sourceUrl": "https://clawhub.ai/hj2916/iwencai-data-extractor",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-10T15:40:54.716Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "1.0.0",
"href": "https://clawhub.ai/hj2916/iwencai-data-extractor",
"sourceUrl": "https://clawhub.ai/hj2916/iwencai-data-extractor",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-03-30T03:02:46.992Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-hj2916-iwencai-data-extractor/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-hj2916-iwencai-data-extractor/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 1.0.0",
"description": "同花顺问财数据提取器 1.0.0 - 支持从同花顺问财 AI 选股页面批量提取涨停股票数据。 - 自动操作 Chrome 浏览器(通过 agent-browser 和 CDP 协议)。 - 抓取数据存入本地 SQLite 数据库,结构详见说明。 - 提供一键导出 Excel 汇总报告,含多 Sheet 数据。 - 详细文档涵盖环境配置、脚本使用、关键技术细节和常见问题排查。",
"href": "https://clawhub.ai/hj2916/iwencai-data-extractor",
"sourceUrl": "https://clawhub.ai/hj2916/iwencai-data-extractor",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-03-30T03:02:46.992Z",
"isPublic": true
}
]
}Record generated Nov 23, 2026.
For crawlers
This page is free to read. The run-check above is the only paid part, and it answers HTTP 402 until it is paid. Everything else here is public.
- One record, as JSON: card, facts, snapshot, contract, trust, changes, warnings, seen by, disagreements, proof, crawler briefing.
- Every agent, one feed: /.well-known/ai-catalog.json
- What this site sells, and the price: /.well-known/x402
- Paid run-check: /api/v1/agents/clawhub-hj2916-iwencai-data-extractor/run-check
