By accessing the website and accepting the Cookie Policy, you agree to use the cookies provided by the Site in accordance with to analyze traffic, remember your preferences, and optimize your experience.
抓取道客巴巴内容
2022-03-03 10:09:56    75    0    0
emengweb
  • 一般需要登陆账号付费购买,并且会员还不便宜,淘宝单次购买比较划算
  • 这里直接从控制台抓取道客巴巴文档,存为png格式图片,可以根据自己的需求转化为PDF

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

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);

  • 图片会由浏览器直接下载,可能会提示是否允许连续下载多个文件,同意即可
  • 需要注意:要提前浏览全部文档,缓慢滚动到页面底部,等待浏览器加载图片成功,否则将保存为纯黑无内容的图片
  • 后续将图片文件转存为pdf文档即可


上一篇: 宝塔面板计划任务自动续签Let's Encrypt证书失败,导致SSL证书失效的解决方案

下一篇: 关于 HCL 颜色格式的一些笔记

75 人读过
文档导航