I am opening HTML pages in a new window. These pages have a media file ".mp4" among other tags. I am able to save the page through this code:
How to download only the media inside of each HTML page opened? There is a way to find and save any media these pages load?
var anchor = document.getElementsByTagName('a');
for (var i=0; i < anchor.length; i++){
    fetch(anchor[i].href)
        .then(resp => resp.blob())
        .then(blob => {
            const url = window.URL.createObjectURL(blob);
            const a = document.createElement('a');
            a.style.display = 'none';
            a.href = url;
            a.setAttribute('target', '_blank');
            a.download = anchor[i].innerText; // the file name
            document.body.appendChild(a);
            a.click();
            window.URL.revokeObjectURL(url);
        });
}