Search code examples
phphtmlpdfdownloadbulk

PDF downloading as PHP or htm file,any way to bulk download?


Some sites not allowing me to download pdfs using IDM or any bulk downloader,when I download all links the files appears as xyz.php,but when I click individual links it redirects me to the main pdf file,since there are 1000+ pdf I need to download its impossible for me to download each by clicking and then waiting to load the site is HERE

Help me a way out of it,trying different methods for months,searching for solution for years,any way out atleast to be more efficient!will be forever grateful if anyone can help me from this difficult problem.


Solution

  • I tested this solution with Chrome 70 and JDownloader 2 and it downloads all the files listed in the link you posted in the question.

    These are the steps you have to follow:

    1. Go to the page you have linked (it works for other "folders" in the upper page)
    2. Press F12 to open the Developer Console. Go to the "Console" tab
    3. Copy and paste this code:

    -

    var copyText = document.createElement("TEXTAREA");
    document.body.appendChild(copyText);
    document.querySelectorAll('li[data-name$=".pdf"]').forEach(function(o) {
        var link = "https://pastpapers.papacambridge.com/" + o.getAttribute("data-href");
        copyText.innerHTML += link + "\n";
        console.log(link);
    });
    copyText.select();
    document.execCommand("copy");
    
    1. Press "Enter". Now you should have all the full links listed in the page in your clipboard. Check it by opening the notepad and pasting anything you have. It should give you the file list in the page where you have executed the script. If not, you can still see all the links in the console.
    2. Now paste the list in any bulk downloader, like JDownloader 2. It worked for me!