|
| 1 | +// ==UserScript== |
| 2 | +// @name Youtubemultidownloader download all at once |
| 3 | +// @namespace http://tampermonkey.net/ |
| 4 | +// @version 0.1 |
| 5 | +// @description Download every link from youtubemultidownloader.org |
| 6 | +// @author You |
| 7 | +// @match https://youtubemultidownloader.org/ |
| 8 | +// @match https://*.googlevideo.com/videoplayback* |
| 9 | +// @icon https://www.google.com/s2/favicons?sz=64&domain=youtubemultidownloader.org |
| 10 | +// @grant none |
| 11 | +// ==/UserScript== |
| 12 | + |
| 13 | +(function() { |
| 14 | + |
| 15 | + function downloadURI(uri, name) { |
| 16 | + var link = document.createElement("a"); |
| 17 | + link.download = name; |
| 18 | + link.href = uri; |
| 19 | + document.body.appendChild(link); |
| 20 | + link.click(); |
| 21 | + document.body.removeChild(link); |
| 22 | + delete link; |
| 23 | + } |
| 24 | + |
| 25 | + |
| 26 | + function download_all_fucken_shit (){ |
| 27 | + var links = document.querySelectorAll('.video-card'); |
| 28 | + for(var i = 0; i<links.length; i++){ |
| 29 | + var title = links[i].querySelector('.titles').textContent.replace(/Size: .*/, '').trim(); |
| 30 | + if(!title) |
| 31 | + continue; |
| 32 | + |
| 33 | + var linky = links[i].querySelector('.links a'); |
| 34 | + if(!linky) |
| 35 | + continue; |
| 36 | + window.open(linky.href); |
| 37 | + } |
| 38 | + } |
| 39 | + |
| 40 | + |
| 41 | + var button = document.createElement("button"); |
| 42 | + button.innerHTML = "download_all_fucken_shit"; |
| 43 | + var body = document.querySelector('.continer'); |
| 44 | + if(body){ |
| 45 | + body.appendChild(button); |
| 46 | + |
| 47 | + button.addEventListener ("click", function() { |
| 48 | + download_all_fucken_shit(); |
| 49 | + }); |
| 50 | + } |
| 51 | + |
| 52 | + |
| 53 | + var winUrl = window.location.href.toString(); |
| 54 | + if(winUrl.indexOf('youtubemultidownloader') > 0 && winUrl.indexOf('googlevideo.com') > 0){ |
| 55 | + const params = new Proxy(new URLSearchParams(window.location.search), { |
| 56 | + get: (searchParams, prop) => searchParams.get(prop), |
| 57 | + }); |
| 58 | + |
| 59 | + let title = params.title; |
| 60 | + downloadURI(winUrl, title + ".m4a"); |
| 61 | + } |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | +})(); |
0 commit comments