Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // open all sections
- $$('section.module:not(.open) header').forEach((h) => h.click());
- // get all list course videos in each section
- let listItems = $$('section.module li');
- // download them
- for (let i = 0; i < listItems.length; i++) {
- let listItem = listItems[i];
- let title = listItem.querySelector('h3').textContent;
- let number = `000${i}`.slice(-3);
- let videoName = `${number}-${title}.mp4`;
- listItem.click();
- await new Promise((resolve) => setTimeout(resolve, 3000));
- let video = document.querySelector('video');
- let url = video.src;
- const response = await fetch(url);
- const blob = await response.blob();
- let a = document.createElement('a');
- a.href = window.URL.createObjectURL(blob);
- a.download = videoName;
- document.body.appendChild(a);
- a.click();
- a.remove();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement