问题描述
我有大量的片段,想一次性下载所有片段。我注意到您可以一次下载一个,但我的数量太多,无法快速全部下载。
解决方法
使用 devtools-on-devtools:
-
打开 devtools 并将其在菜单中的
Dock side
切换到分离(浮动)窗口 -
在现在分离的开发工具中按 CtrlShifti 或 ⌘Shifti 在 MacOS 上,
这将在新窗口中打开 devtools-on-devtools -
在 devtools-on-devtools 中切换到控制台,粘贴并运行此代码:
Host.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); } });