I have a large number of snippets, and want to download all of them at once. I noticed that you can download one at a time, but I have too many to do all of them quickly.
Asked
Active
Viewed 526 times
1 Answers
1
Use devtools-on-devtools:
open devtools and switch its
Dock side
in the menu to a detached (floating) windowin the now detached devtools press CtrlShifti or ⌘Shifti on MacOS,
which will open devtools-on-devtools in a new windowin devtools-on-devtools switch to console, paste and run this code:
(Host.InspectorFrontendHost || InspectorFrontendHost).getPreferences(async r => { for (const {name, content} of JSON.parse(r.scriptSnippets || '[]')) { const a = document.createElement('a'); const url = URL.createObjectURL(new Blob([content], {type: 'text/plain'})); a.href = url; a.download = name + '.txt'; a.dispatchEvent(new MouseEvent('click')); console.log(name + '...'); await new Promise(resolve => setTimeout(resolve, 150)); URL.revokeObjectURL(url); } });

wOxxOm
- 65,848
- 11
- 132
- 136
-
1it's work ? i got error: Uncaught TypeError: Cannot read properties of undefined (reading 'getPreferences') – OriEng Mar 13 '22 at 16:59