HOW TO programmatically access all links on a web page

If you have to download files all files whose links are listed on a web page, this scripted method can accomplish the task faster (after some customization to the specific context) from the console tab of the Developer Tools feature of popular browsers -

Array.prototype.forEach.call(
    document.querySelectorAll("a.download[href*=x64]"),
    function (a) {
        console.log("wget " + a.href);
    });

With jQuery, it's even more terser -

$("a.download[href*=x64]").each(function () {
    console.log("wget " + this.href);
});

Comments

Popular posts from this blog

2 ways to copy tooltip text from a web page

This Week I Learned - Week 27 2026

HOW TO download files hosted in Azure Web App in bulk