Created
December 3, 2020 14:44
-
-
Save CSFelix/58140de40542b61ad1af2dbe18772f2a to your computer and use it in GitHub Desktop.
Third Gist in the Page: https://csfelix.github.io/includes/how-to-do-web/tube-me.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let Btn = document.getElementById('btn'); | |
| let URLinput = document.getElementById('URL-input'); | |
| let select = document.querySelector('.opt'); | |
| let serverURL = 'http://localhost:4000'; | |
| Btn.addEventListener('click', () => { | |
| if (!URLinput.value) { alert('Put the link before to download!'); } | |
| else { | |
| if (select.value == 'mp3') { redirectMp3(URLinput.value); } | |
| else if (select.value == 'mp4') { redirectMp4(URLinput.value); } | |
| } | |
| }); | |
| function redirectMp3(query) { window.location.href = `${serverURL}/downloadmp3?url=${query}`; } | |
| function redirectMp4(query) { window.location.href = `${serverURL}/downloadmp4?url=${query}`; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment