批量下载 Amazon Kindle 商店中已经购买的书籍
参考: https://bookfere.com/post/983.html
Chrome 访问 https://z.cn/myk,按 F12(Mac右键“检查元素”),选择 Console 并将下面的脚本复制粘贴然后按回车。脚本是从上面的链接生成的,并且选择的是每 30 秒下载一个文件。
(function() {
if (!window.location.hash.startsWith('#/home/content/booksAll/dateDsc/')) {
alert('Need to visit: https://z.cn/myk');
return;
};
const w = ms => new Promise(r => setTimeout(r, ms)),
n = z => parseInt($('.contentCount_myx').text().match(/(\d+)/g)[z]),
a = n(0),
p = x => console.log(x);
let c = 0,
v = 0;
(async function g() {
let ls = $('.contentTableListRow_myx li'),
l = ls.length,
s = n(2);
if (l < 200 && s < a) {
window.scrollTo(0, $('body').outerHeight());
} else {
for (const j of ls.get()) {
p('Downloading: ' + $(j).find('div[bo-text="tab.title"]').text());
$(j).find('button[aria-label="actions"]').click();
$('#contentAction_download_myx').click();
$('a[id="dialogButton_ok_myx "').click();
v += 1;
p('Total: ' + a + ' Done: ' + v);
await w(30000);
}
c += l;
if (s == a) {
p('Done.');
return;
} else {
$('.contentTableShowMore_myx').eq(1).click();
}
}
await w(2000);
await g();
})()
})();