Download mp4 files at once with jQuery via console

0 votes

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);
        });
}

Jul 19, 2022 in Web Development by gaurav
• 23,260 points
630 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Web Development

0 votes
1 answer

How to download a file by jQuery.Ajax?

Hello @kartik, You don't need to do this ...READ MORE

answered Sep 18, 2020 in Web Development by Niroj
• 82,880 points
7,194 views
0 votes
1 answer

How to use JQuery with ReactJS

Yes, we can use jQuery in ReactJs. ...READ MORE

answered Jun 22, 2022 in Web Development by rajatha
• 7,640 points

edited Dec 15, 2023 by Soumya 13,911 views
0 votes
1 answer

Check if checkbox is checked with jQuery

To check whether a Checkbox has been ...READ MORE

answered Jun 23, 2022 in Web Development by rajatha
• 7,640 points
956 views
0 votes
1 answer

Download File Using jQuery

I might suggest this, as a more ...READ MORE

answered Jun 28, 2022 in Web Development by rajatha
• 7,640 points
1,413 views
0 votes
1 answer

How to hide a div with jQuery?

We hide the divs by adding a CSS ...READ MORE

answered Jun 27, 2022 in Web Development by rajatha
• 7,640 points
269 views
0 votes
0 answers

How to add a link in Jquery PrettyPhoto to download the image

I am using Jquery PrettyPhoto to have ...READ MORE

Jun 29, 2022 in Web Development by gaurav
• 23,260 points
648 views
0 votes
1 answer
0 votes
1 answer

What's the difference between using "let" and "var"?

The main difference is scoping rules wherein ...READ MORE

answered Feb 17, 2022 in Java by Aditya
• 7,680 points
447 views
0 votes
0 answers

How to run a PHP function due to a button click (with button 'data' passed)?

I manage some sortiment items on a ...READ MORE

May 28, 2022 in PHP by Kichu
• 19,050 points
3,565 views
0 votes
1 answer

Download File Using JavaScript/jQuery

Download Files Create a DOMString that contains the ...READ MORE

answered Jun 10, 2022 in JQuery by gaurav
• 23,260 points
1,519 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP