Pexels Downloader
- Visit any query/page/collection you want downloaded.
- Scroll down untill everything is loaded.
- Paste the snippet into the developer tools and press return.
Profit.
Last active 2 months ago
Profit.
| 1 | (async function() { |
| 2 | // Helper function to wait for a given number of milliseconds |
| 3 | function wait(ms) { |
| 4 | return new Promise(resolve => setTimeout(resolve, ms)); |
| 5 | } |
| 6 | |
| 7 | // Function to process each article |
| 8 | async function processArticles() { |
| 9 | const articles = document.querySelectorAll('article'); |
| 10 | |
| 11 | for (let i = 0; i < articles.length; i++) { // change 0 in case you need to restart the script and need to define a new index. See index in console log |
| 12 | const article = articles[i]; |
| 13 | const downloadButton = article.querySelector('a[download][title="Download"]'); |
| 14 | |
| 15 | if (downloadButton && !downloadButton.href.includes('/video/')) { |
| 16 | try { |
| 17 | // Emulate button click |
| 18 | downloadButton.click(); |
| 19 | console.log(`Clicked download button for video ID: ${downloadButton.href.split('/').pop()} at article index: ${i}`); |
| 20 | |
| 21 | // Wait for |
| 22 | await wait(200); |
| 23 | } catch (error) { |
| 24 | console.error('An error occurred:', error); |
| 25 | break; |
| 26 | } |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | // Start processing the articles |
| 32 | processArticles(); |
| 33 | })(); |