在 AI 时代,无论是使用 OpenClaw、Hermes Agent,还是实践 Obsidian + LLM 的信息管理方法论,一键入库、人机共用的 AI 信息库搭建都是必备的基础设施。
Web-to-FIM 就是这样一个基础技能:它将任意网络内容一键转换为结构化 Markdown,并同步到:
将任意网页链接或本地文件一键转为结构化 Markdown,并保存到 Obsidian Vault、飞书云文档或腾讯 IMA 笔记。
| 信源 | URL 特征 | 抓取方式 |
|---|---|---|
| ------ | --------- | --------- |
| X/Twitter | x.com / twitter.com | x-tweet-fetcher |
| 微信公众号 | mp.weixin.qq.com | markitdown-plus |
| 小红书 | xiaohongshu.com / xhslink.com | markitdown-plus |
| 微博 | weibo.com | markitdown-plus |
| YouTube | youtube.com / youtu.be | markitdown-plus |
| 任意网页 | 其他 http(s):// 链接 | markitdown-plus |
| 类型 | 扩展名 |
|---|---|
| ------ | -------- |
.pdf | |
| Word | .docx / .doc |
| PowerPoint | .pptx / .ppt |
| Excel | .xlsx / .xls |
| 图片 | .png .jpg .jpeg .gif .webp |
| 音频 | .mp3 .wav .m4a .flac |
| 数据 | .csv .json .xml |
| 目的地 | 环境变量 | 说明 |
|---|---|---|
| -------- | --------- | ------ |
| Obsidian Vault | OBSIDIAN_VAULT_PATH | 本地保存到指定目录,带 frontmatter(默认:E:\Obsidian\md\inbox) |
| 飞书云文档 | FEISHU_APP_ID + FEISHU_APP_SECRET | 云端服务,参考 references/feishu-setup.md |
| 腾讯 IMA | IMA_CLIENT_ID + IMA_API_KEY | 云端 API,无需本地客户端,参考 references/ima-setup.md |
跨平台支持,通过环境变量 OBSIDIAN_VAULT_PATH 配置:
# Windows (PowerShell)
$env:OBSIDIAN_VAULT_PATH = "C:\Users\YourName\Obsidian\Vault\inbox"
# Windows (CMD)
set OBSIDIAN_VAULT_PATH=C:\Users\YourName\Obsidian\Vault\inbox
# macOS/Linux
export OBSIDIAN_VAULT_PATH=~/Obsidian/Vault/inbox
如果未设置,默认使用:
E:\Obsidian\md\inbox~/Obsidian/inbox使用 web_to_all.py 一键转换并保存到 Obsidian/飞书/IMA:
python3 scripts/web_to_all.py --url "<url_or_path>"
python3 scripts/web_to_all.py --url "<url>" --title "自定义标题"
python3 scripts/web_to_all.py --url "<url>" --no-feishu --no-ima # 仅保存 Obsidian
⚠️ 凭证必须通过环境变量配置,禁止硬编码:
# 设置环境变量
$env:FEISHU_APP_ID = "your_app_id"
$env:FEISHU_APP_SECRET = "your_app_secret"
参考 references/feishu-setup.md 获取凭证。
# 设置环境变量
$env:IMA_CLIENT_ID = "your_client_id"
$env:IMA_API_KEY = "your_api_key"
参考 references/ima-setup.md 获取凭证。
python3 scripts/web_to_md.py --url "<url_or_path>" --output <output.md>
路由逻辑:
from scripts.web_to_all import save_to_obsidian
filepath = save_to_obsidian(markdown_content, title, url)
from scripts.feishu_client import FeishuClient
client = FeishuClient()
result = client.create_document(title="文档标题", content_md=markdown_content)
print(f"文档 URL: {result['url']}")
from scripts.ima_client import IMAClient
client = IMAClient()
result = client.create_note(title="笔记标题", content=markdown_content)
print(f"笔记 URL: {result['url']}")
# 验证飞书
python scripts/feishu_client.py --action test
# 验证 ima
python scripts/ima_client.py --action test
| 问题 | 解决方案 |
|---|---|
| ------ | --------- |
| x.com SSL 超时 | x-tweet-fetcher 使用 FxTwitter API 中转 |
| markitdown 模块丢失 | pip install markitdown |
| 微信反爬拦截 | markitdown 自动用移动端 UA 重试 |
| 飞书凭证无效 | 检查 FEISHU_APP_ID 和 FEISHU_APP_SECRET |
| ima 凭证无效 | 检查 IMA_CLIENT_ID 和 IMA_API_KEY |
| 依赖 | 安装命令 | 说明 |
|---|---|---|
| ------ | --------- | ------ |
| markitdown | pip install markitdown | 网页转 Markdown 核心库 |
| requests | pip install requests | HTTP 请求 |
| python-dotenv | pip install python-dotenv | 环境变量管理 |
| x-tweet-fetcher | 克隆到 ~/.aily/workspace/skills/x-tweet-fetcher | X/Twitter 专用抓取(可选) |
# 安装 Python 依赖
pip install markitdown requests python-dotenv
# 克隆到技能目录
cd ~/.aily/workspace/skills
git clone https://github.com/EdwardWason/x-tweet-fetcher.git
如果不安装 x-tweet-fetcher,X/Twitter 链接将使用 markitdown 直接处理。
--no-feishu / --no-ima` 选择性禁用功能共 1 个版本