ChatGPT to Notion Exporter

ChatGPT 导出到 Notion:智能图片归位 (支持 PicList/PicGo)+隐私开关+单个对话导出

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Autor
wyih
Dnevne instalacije
4
Ukupno instalacija
7
Ocene
0 0 0
Verzija
2.15
Napravljeno
02. 12. 2025
Ažurirano
04. 12. 2025
Size
33,6 КБ
Licenca
MIT
Važi za

📑 ChatGPT to Notion Exporter

这个脚本能够将 ChatGPT 的对话内容(包括富文本、代码块、以及图片)一键完美导出到 Notion 数据库中。

此版本基于 Gemini版 移植,功能和Gemini版保持一致。


✨ 核心功能 (Core Features)

  1. 🖼️ 强力图片支持 (PicList 集成)

    • 用户上传图片:完美支持!修复了因 ChatGPT DOM 结构变化(图片嵌套在 Button 中)导致的无法抓取问题,使用原生 Fetch 方案,稳定上传 Blob 图片。
    • AI 生成图片 (DALL-E):支持导出模型生成的图片,并内置智能去重逻辑(Smart Dedupe),自动过滤掉 ChatGPT 为了磨砂背景效果而生成的重复图片层,只保留一张清晰原图。
    • 图床自动上传:由于 Notion API 限制,脚本会自动将图片上传到你本地配置的 PicList/PicGo,并获取 HTTPS 链接写入 Notion,确保图片永久有效。
  2. 🧹 极致整洁的排版

    • 严格空行清理:内置严格文本清洗逻辑,自动去除 ChatGPT 回复中无意义的空行和冗余空白,让 Notion 笔记紧凑、美观。
    • 富文本保留:完美保留标题(H1-H3)、粗体、斜体、引用块、无序/有序列表、表格等格式。
  3. 🧠 智能代码块

    • 自动识别代码语言,并在 Notion 中生成带高亮的代码块。
    • 防截断机制:针对 Notion API 的 2000 字符限制,脚本会自动智能切分长代码,防止报错丢失。
  4. 🖱️ 丝滑的交互体验 (Sticky UI)

    • 隐私开关 (👁️):每条对话右上角都有隐私眼睛图标,点击即可跳过该条消息,不导出无关内容。
    • 单条导出 (📤):支持只导出某一条特定的问答,无需全量备份。
    • 悬浮跟随:操作按钮会智能吸附在气泡右上角,无论对话多长,按钮始终触手可及。

🛠️ 准备工作 (Prerequisites)

为了实现图片上传功能,本脚本依赖 PicList (PicGo 的增强版) 来作为中转服务。

  1. 安装 PicList下载地址
  2. 配置 PicList 服务端
    • 打开 PicList 设置 -> 设置服务器。
    • 确保端口为 36677(默认)。
    • 必须开启:确保 PicList 在后台运行,且已配置好你喜欢的图床(如 SM.MS, GitHub, 阿里云 OSS 等)。
  3. 获取 Notion Token
    • Notion Integrations 创建一个 Integration,获取 Internal Integration Secret
    • 在 Notion 中创建一个 Database(数据库),点击右上角 ... -> Connect -> 选择刚才创建的 Integration。
    • 获取该 Database 的 ID(URL 中 notion.so/ 后面 ?v= 之前的那串 32 位字符)。

🚀 使用指南 (How to Use)

  1. 安装本脚本。
  2. 刷新 ChatGPT 页面。
  3. 点击页面右下角的 "📥 Save to Notion" 按钮,或者点击任意气泡右上角的 📤 按钮。
  4. 首次运行时,脚本会弹窗提示输入:
    • Notion Integration Secret
    • Notion Database ID
  5. 脚本会自动处理图片上传(观察控制台或 PicList 状态)并将内容写入 Notion。
  6. 完成后按钮会变为 "✅ Saved"。

❓ 常见问题 (FAQ)

Q: 为什么图片没有导出? A: 请检查:

  1. PicList 是否已启动?
  2. PicList 的端口是否为 36677
  3. 浏览器是否拦截了 127.0.0.1 的请求?(通常 Tampermonkey 会弹出请求权限,请点击“总是允许”)。

Q: 为什么提示 Notion Error? A: 请检查你的 Notion Integration 是否已经 Connect(连接)到了目标 Database。仅有 ID 和 Token 是不够的,必须在 Notion 页面手动授权连接。