有没有办法从不仅仅是HTML链接的站点中抓取下载文件?



所以我单独浏览每个链接来下载 photoshop 预设的文件,至少可以说有点累。我一直在研究实际抓取文件的方法,而不仅仅是HTML链接或某种从页面中一次获取所有文件的方法,但我没有任何运气。我不精通python所以这对我来说没有任何意义,而且我为我安装的程序没有下载我正在寻找的内容。

尝试过Chrome扩展程序,网络抓取软件,但它没有按照我想要的方式工作。

https://www.brusheezy.com/brushes/22482-star-glow-brushes

这只是一个页面上的链接之一

我希望找到一些可以从页面上的链接实际下载zip文件的东西。

注意:我还没有让它工作,但认为这种方法可能值得考虑。我会尝试回来改进或删除它。

您可以在浏览器的开发工具中执行类似的操作。您必须为此禁用弹出窗口阻止程序。这对我来说不太有用,因为下载按钮开始抛出帐户注册对话框。我怀疑他们可能会在下载一些次数后这样做,但如果您有帐户并登录,您可能会有更好的运气。

导航到上传者的页面,打开浏览器的开发人员工具,粘贴下面的代码并按 Enter 键。

function go () {
    // get all the links from the grid on the current page
    const hrefs = Array.from(document.querySelectorAll('.ez-resource-grid a[href]')).map(a => a.href);
    // start the loading
    next(hrefs);
}
function next ([current, ...remaining]) {
    // open a new tab/window with the current href;
    const w = window.open(current, '_blank');
    // function to find the download button and "click" it.
    function triggerDownload () {
        try {
            w.querySelector('#download-button').click();
        }
        catch (e) {
            // something went wrong.
        }
        // if we haven't consumed all the links yet, start the next one.
        if (remaining.length) {
            next(remaining);
            // I tried adding a delay here thinking the account signup dialog
            // might be triggered by too many rapid requests, but it didn't
            // seem to matter.
            // setTimeout(() => next(remaining), 6000);
        }
    }
    // give the page a few seconds to load before attempting
    // to trigger the download. This should be replaced with
    // a ready event listener instead of a fixed delay, something
    // like:
    // w.document.addEventListener('readystatechange', triggerDownload)
    // but i'm tired and my first attempt didn't appear to work so i'm
    // throwing in this static delay hack instead.
    setTimeout(triggerDownload, 5000);
}
// kick it off
go();

最新更新