抓取道客巴巴内容

📌

  • 一般需要登陆账号付费购买,并且会员还不便宜,淘宝单次购买比较划算
  • 这里直接从控制台抓取道客巴巴文档,存为png格式图片,可以根据自己的需求转化为PDF
    🕤😴

直接打开浏览器控制台,输入以下脚本:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function downloadPages(from, to) {
for (i = from; i <= to; i++) {
const pageCanvas = document.getElementById('page_' + i);
if (pageCanvas === null) { break; }
const pageNo = parseInt(String(i));
setTimeout(() => {
console.log("==pageNo==>>", pageNo);
((num) => {
console.log("开始打印第" + num + "页");
pageCanvas.toBlob(
blob => {
const anchor = document.createElement('a');
anchor.download = 'page_' + num + '.png';
anchor.href = URL.createObjectURL(blob);
anchor.click();
URL.revokeObjectURL(anchor.href);
}
);
})(pageNo);
}, 500 * pageNo);
}
}

downloadPages(page_from, page_to); 例如打印第3~5页即输入downloadPages(3, 5);

  • 图片会由浏览器直接下载,可能会提示是否允许连续下载多个文件,同意即可
  • 需要注意:要提前浏览全部文档,等待浏览器加载成功,否则将保存为纯黑无内容的图片
  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.

请我喝杯咖啡吧~