Skip to content

Instantly share code, notes, and snippets.

@rnmhdn
Last active May 12, 2026 09:01
Show Gist options
  • Select an option

  • Save rnmhdn/c615ccd0874b4db1b9121b48459ec6c4 to your computer and use it in GitHub Desktop.

Select an option

Save rnmhdn/c615ccd0874b4db1b9121b48459ec6c4 to your computer and use it in GitHub Desktop.
A lightweight bookmarklet that extracts complete conversations from DeepSeek Chat and copies them to your clipboard in a clean, readable format.

DeepSeek Chat Exporter

A lightweight bookmarklet that extracts complete conversations from DeepSeek Chat and copies them to your clipboard in a clean, readable format.

Features

  • 🔄 Auto-scrolls to load all messages (even long conversations)
  • 🧠 Captures thought processes (DeepSeek's reasoning steps)
  • 💬 Separates user prompts from AI responses
  • 📋 One-click copy to clipboard
  • No dependencies - pure vanilla JavaScript

Installation

  1. Create a new bookmark in your browser
  2. Name it (e.g., "Export DeepSeek Chat")
  3. Copy the minified code below into the URL field

Minified Version

// TODO: Insert minified code here

Or use the readable version in console

Paste the full script into your browser's DevTools console while on a DeepSeek chat page.

Usage

  1. Open any DeepSeek conversation
  2. Click the bookmarklet
  3. Wait while it auto-scrolls to load all messages
  4. Your conversation is automatically copied to clipboard!

Output Format Example

{{{1 Turn 1
[User Prompt]
Explain quantum computing in simple terms

[DeepSeek Thought Process]
The user wants a simple explanation of quantum computing. I should avoid jargon and use analogies like the coin flip or spinning ball analogy. Focus on superposition and entanglement.

[DeepSeek Final Response]
Think of a regular computer like a light switch - it's either ON or OFF. A quantum computer is like a dimmer switch - it can be ON, OFF, or anything in between at the same time! This lets it solve certain problems much faster.

}}}
{{{2 Turn 2
[User Prompt]
Give me an example

[DeepSeek Thought Process]
The user wants a concrete example. I'll use the maze or cryptography example which clearly demonstrates quantum advantage.

[DeepSeek Final Response]
Imagine trying to find the right key to open a door. A regular computer tries keys one by one. A quantum computer can try ALL keys simultaneously because of superposition. That's why it could break current encryption!
}}}

Parameters (Customize in source)

Variable Default Description
SCROLL_STEP 300px How much to scroll on each attempt
STABLE_DELAY 1500ms Time without new messages before finishing
MAX_RETRIES 15 Maximum scroll attempts (safety limit)

How It Works

  1. Finds scroll container - Automatically detects the chat container
  2. Scans upward - Scrolls to trigger lazy loading of older messages
  3. Detects stability - Stops when no new messages appear after 3 checks
  4. Extracts structured data - Separates user/assistant messages and thought processes
  5. Copies to clipboard - Formats as Markdown-friendly text

Limitations

  • Works only on DeepSeek Chat web interface
  • May not capture extremely long conversations (browser memory limits)
  • Requires page to remain open during extraction

Browser Support

  • ✅ Chrome/Edge/Brave (all Chromium-based)
  • ✅ Firefox
  • ✅ Safari (requires enabling "Show Develop menu" → "Allow JavaScript from Smart Search field")

Troubleshooting

Issue Solution
"No conversation found" Make sure you're on a DeepSeek chat page
Nothing copied Check console for errors (F12)
Missing some messages Increase MAX_RETRIES or STABLE_DELAY
Page freezes Your conversation is extremely long - try exporting earlier parts first

License

MIT - Use freely, modify as needed.

Credits

Created for the DeepSeek community. Feedback welcome via GitHub issues/c discussions.


Tip: For frequent use, place this bookmarklet on your bookmarks bar for one-click access.

javascript:(function(){
const SCROLL_STEP = 300; // pixels per scroll jump
const STABLE_DELAY = 1500; // time without new messages before we stop
const MAX_RETRIES = 15; // safety limit
// Find the scrollable container that holds .ds-message elements
const sample = document.querySelector('.ds-message');
if (!sample) { alert('No conversation found.'); return; }
let container = sample.parentElement;
while (container) {
const style = getComputedStyle(container);
if (style.overflowY === 'auto' || style.overflowY === 'scroll') break;
container = container.parentElement;
}
// fallback to document body
if (!container) container = document.scrollingElement || document.body;
let lastCount = 0;
let stableFrames = 0;
let retries = 0;
alert('Loading all messages… please wait.');
function stepScroll() {
const currentCount = document.querySelectorAll('.ds-message').length;
if (currentCount === lastCount) {
stableFrames++;
} else {
stableFrames = 0;
lastCount = currentCount;
}
// If stable for a while, assume everything is loaded
if (stableFrames > 3) {
// final extraction
extractConversation();
return;
}
retries++;
if (retries > MAX_RETRIES) {
alert('Loading timed out – extracted whatever was visible.');
extractConversation();
return;
}
// scroll up by one step
container.scrollTop = Math.max(0, container.scrollTop - SCROLL_STEP);
setTimeout(stepScroll, 600);
}
function extractConversation() {
const output = [];
let turn = 1;
let prompt = null;
document.querySelectorAll('.ds-message').forEach(msg => {
if (!msg.querySelector('.ds-markdown')) {
// user message
const clone = msg.cloneNode(true);
clone.querySelectorAll('.ds-icon-button, .ds-icon').forEach(el => el.remove());
const text = clone.innerText.trim();
if (text) prompt = text;
return;
}
// assistant message
if (!prompt) return;
const think = msg.querySelector('.ds-think-content');
const thought = think ? think.innerText.trim() : '(No thought process visible)';
const resp = msg.querySelector('.ds-markdown:not(.ds-think-content .ds-markdown)');
const response = resp ? resp.innerText.trim() : '(No final response visible)';
output.push(`{{{1 Turn ${turn}}}`, '[User Prompt]', prompt, '',
'[DeepSeek Thought Process]', thought, '',
'[DeepSeek Final Response]', response, '}}}', '');
turn++;
prompt = null;
});
const finalText = output.join('\n').trim();
if (!finalText) {
alert('No conversation extracted.');
return;
}
navigator.clipboard.writeText(finalText).then(() => {
alert(`Copied ${turn-1} turn(s) to clipboard.`);
}).catch(() => prompt('Copy manually:', finalText));
}
// reset scroll to top and start
container.scrollTop = 0;
lastCount = document.querySelectorAll('.ds-message').length;
setTimeout(stepScroll, 800);
})();
javascript:(function(){const d=300,e=1500,f=15,g=document.querySelector('.ds-message');if(!g){alert('No conversation found.');return}let h=g.parentElement;while(h){const i=getComputedStyle(h);if(i.overflowY==='auto'||i.overflowY==='scroll')break;h=h.parentElement}if(!h)h=document.scrollingElement||document.body;let j=0,k=0,l=0;alert('Loading all messages\u2026 please wait.');function m(){const n=document.querySelectorAll('.ds-message').length;if(n===j){k++}else{k=0;j=n}if(k>3){o();return}l++;if(l>f){alert('Loading timed out \u2013 extracted whatever was visible.');o();return}h.scrollTop=Math.max(0,h.scrollTop-d);setTimeout(m,600)}function o(){const p=[];let q=1,r=null;document.querySelectorAll('.ds-message').forEach(s=>{if(!s.querySelector('.ds-markdown')){const t=s.cloneNode(true);t.querySelectorAll('.ds-icon-button,.ds-icon').forEach(u=>u.remove());const v=t.innerText.trim();if(v)r=v;return}if(!r)return;const w=s.querySelector('.ds-think-content');const x=w?w.innerText.trim():'(No thought process visible)';const y=s.querySelector('.ds-markdown:not(.ds-think-content .ds-markdown)');const z=y?y.innerText.trim():'(No final response visible)';p.push(`{{{1 Turn ${q}}}`,'[User Prompt]',r,'','[DeepSeek Thought Process]',x,'','[DeepSeek Final Response]',z,'}}}','');q++;r=null});const A=p.join('\n').trim();if(!A){alert('No conversation extracted.');return}navigator.clipboard.writeText(A).then(()=>{alert(`Copied ${q-1} turn(s) to clipboard.`)}).catch(()=>prompt('Copy manually:',A))}h.scrollTop=0;j=document.querySelectorAll('.ds-message').length;setTimeout(m,800)})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment