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

Maven Crash Course - Learn Power Query, Power Pivot & DAX in 15 Minutes

"Data Prep & Exploratory Data Analysis" course by Maven Analytics

Oracle Cloud Infrastructure 2024 Generative AI Professional Course & Certification Exam (1Z0-1127-24)