Skip to content

Instantly share code, notes, and snippets.

@xenoncolt
Last active July 27, 2025 20:10
Show Gist options
  • Save xenoncolt/82f94e2d65aa871a7bbc51b47eb8250e to your computer and use it in GitHub Desktop.
Save xenoncolt/82f94e2d65aa871a7bbc51b47eb8250e to your computer and use it in GitHub Desktop.
Instruction for to Download All files at once using console from AIUB Portal

Instruction for to download all files at once using console from AIUB Portal

To download all files from the AIUB Portal using the console, you can use a simple script. Here’s how to do it:

  1. Login to the aiub portal in your browser and go to the section where you wanna download the file. Check the picure below if it's unclear to you
Click to view the picture image
  1. Press Ctrl+Shift+I OR F12 to open the Developer Tools.
  2. It’ll open the Sources tab. A marked point will be shown, which you need to add to the ignore list and Refresh the page. Just like in the image below:
Click to view the picture image
We do this because the AIUB Portal has a script that blocks certain actions on the inspect page. Ignoring it will disable that behavior.
  1. Now, Go to the Console tab.
(function() {
    window.downloadFile = function(url, name) {
        const a = document.createElement('a');
        a.href = url;
        a.download = name;
        a.click();
        console.log(name);
    };
    
    window.findFiles = function() {
        const links = [];
        document.querySelectorAll('.col-md-12 .table').forEach(t => {
            t.querySelectorAll('tr').forEach(r => {
                lc = r.querySelector('td:nth-child(2) a');
                if (lc && lc.href) links.push(lc);
            })
        })
        console.log('Yup...Found some files:');
        links.forEach((link, i) => {
            console.log(`${i+1}. ${link.textContent.trim()} - ${link.href}`);
        });
        return links;
    };

    window.downloadAllFiles = function() {
        findFiles().forEach((link, i) => {
            setTimeout(() => downloadFile(link.href, link.textContent.trim()), i * 100);
        });
    };
    findFiles();
    downloadAllFiles();
})();
  1. The script will automatically find and popup all PDF files linked on the page.

Side note: Please don't post your "fixed" or "improved" versions of the script in the comments. It creates unnecessary confusion, often doesn't fix anything, and sometimes puts other people's accounts at risk. I might redact/delete such comments without notice. Thank you for understanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment