1

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.

EchoGamer
  • 41
  • 2

1 Answers1

1

Use devtools-on-devtools:

  1. open devtools and switch its Dock side in the menu to a detached (floating) window

    enter image description here

  2. in the now detached devtools press CtrlShifti or Shifti on MacOS,
    which will open devtools-on-devtools in a new window

  3. in 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
  • 1
    it's work ? i got error: Uncaught TypeError: Cannot read properties of undefined (reading 'getPreferences') – OriEng Mar 13 '22 at 16:59