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 in Web Development by gaurav
• 17,580 points
8 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,740 points
5,613 views
0 votes
1 answer

How to use JQuery with ReactJS

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

answered Jun 22 in Web Development by rajatha
• 7,040 points
17 views
0 votes
1 answer

Check if checkbox is checked with jQuery

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

answered Jun 23 in Web Development by rajatha
• 7,040 points
35 views
0 votes
1 answer

Download File Using jQuery

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

answered Jun 28 in Web Development by rajatha
• 7,040 points
15 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 in Web Development by rajatha
• 7,040 points
22 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 in Web Development by gaurav
• 17,580 points
19 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 in Java by Aditya
• 7,300 points
80 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 in PHP by Kichu
• 19,040 points
1,101 views
0 votes
1 answer

Download File Using JavaScript/jQuery

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

answered Jun 10 in JQuery by gaurav
• 17,580 points
315 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP