나만 쓰려고 만든 코드. 백업용
(async (urls) => {
const dhandle = await showDirectoryPicker({ mode: 'readwrite' });
console.group('download');
await urls.reduce(async (acc, cur, idx) => {
const result = await acc;
try {
console.log(`${idx + 1} / ${urls.length} downloading`, cur);
const res = await fetch(cur);
if (!res.ok) throw res;
const blob = await res.blob();
const fhandle = await dhandle.getFileHandle(new URL(cur).pathname.split('/').at(-1), { create: true });
const writable = await fhandle.createWritable();
try {
await writable.write(blob);
} catch (e) {
console.error('write error', e);
} finally {
writable.close();
}
} catch (e) {
console.error('download error', e);
}
return result;
}, Promise.resolve([]));
console.log('download completed!');
console.groupEnd('download');
})([...document.querySelectorAll('figure.fileblock > a')].map(a => a.href));
어떻게 쓰노
두기 웹페이지 다운로드 페이지 가서 F12 > 콘솔 > 복붙 실행
크롬 계열 이외에 보장 못함
정말 혼자 쓰려고했노
이런거 백업 텔레그램에서 자기만 있는 채팅 그룹 만들어서 하면 편함