360 Secure SkillHub
360 安全技能中心

browser-session-archive

该 Skill 通过 Chrome DevTools Protocol 抓取 ChatGPT 与 Claude 的分享链接页面,提取会话 HTML 并转换为 Markdown,按日期与站点目录保存文档、HTML 快照和元数据文件。需已开启远程调试端口的 Chrome,以及 node/bun 运行环境和 ws 依赖,声明支持 macOS 与 Linux。

分类:效率
guobaba1
guobaba1
热度 28.59
最近更新 2026-05-11 17:36:49

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add guobaba1/browser-session-archive
兼容性
通用兼容
联网要求
需要联网
数据出网
数据不出本机
Metadata
name
browser-session-archive
description
Extracts and archives chatgpt.com and claude.ai share links to Markdown using Chrome CDP (e.g., ChatGPT or Claude conversations).
metadata
{"openclaw":{"emoji":"📄","requires":{"bins":["node","bun"],"npm":["ws"]},"install":[{"id":"ws","kind":"npm","label":"Install ws module","packages":[{"name":"ws","global":true}]}],"os":["darwin","linux"]}}

Browser Session Archive

Extracts and archives chatgpt.com and claude.ai share links to Markdown using Chrome DevTools Protocol.

Triggers

User message contains:

  1. Keywords: 提取 chatgpt, 提取 claude, 提取文档, 提取 chatgpt 对话, 提取 claude 对话, 归档 chatgpt 对话, 归档 claude 对话, 保存 chatgpt 对话, 保存 claude 对话, extract chatgpt, extract claude, archive chatgpt, archive claude, save chatgpt, save claude
  2. Links:
    • https://chatgpt.com/share/{share-id}
    • https://claude.ai/share/{share-id}

Usage

Quick Start

# Copy script to PATH
cp {baseDir}/scripts/extract.sh /usr/local/bin/
chmod +x /usr/local/bin/extract.sh

# Run
extract.sh "https://chatgpt.com/share/xxx"
extract.sh "https://claude.ai/share/xxx"

Step by Step

# 1. Capture HTML
cd {baseDir}/scripts
CHROME_DEBUG_PORT=9222 TARGET_URL="https://chatgpt.com/share/xxx" \
  node capture-cdp.js

# 2. Convert to Markdown (use output path from step 1)
node convert-markdown.js --metadata "~/LookBack/$(date +%Y-%m-%d)/ChatGPT/.metadata.json"

Environment Variables

Variable Description Default
CHROME_DEBUG_PORT Chrome debugging port 9222
TARGET_URL Share link URL (required)
OUTPUT_DIR Output directory ~/LookBack/{date}/{ChatGPT|Claude}

Output Structure

~/LookBack/{YYYY-MM-DD}/
├── ChatGPT/
│   ├── {title}-{timestamp}.md              # Markdown file
│   ├── {title}-{timestamp}-captured.html   # HTML snapshot
│   └── .metadata.json                       # Metadata
└── Claude/
    └── ...

Prerequisites

  1. Chrome Debug Mode: Start Chrome with --remote-debugging-port=9222

    # macOS
    open -a "Google Chrome" --args --remote-debugging-port=9222
    
    # Linux
    google-chrome --remote-debugging-port=9222
    
  2. Install Dependencies:

    npm install -g ws
    

Error Handling

Error Cause Solution
Connection refused Chrome debug port not open Start Chrome with --remote-debugging-port
Timeout Page loading slow Increase wait time or refresh manually
Target not found Invalid link Verify the share link is correct

Scripts

Script Description
capture-cdp.js CDP capture script, extracts HTML
convert-markdown.js HTML to Markdown converter
extract.sh One-click entry script

References