Last active
February 16, 2019 11:31
-
-
Save oddoye-david/186deb219b1d1d8f8c69458f5046cf89 to your computer and use it in GitHub Desktop.
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
function download(showname, season = 's01', quality = '720p', encoding = 'x265') { | |
const fileContent = Array.from(document.querySelectorAll('a')) | |
.filter(x => x.href.toLowerCase().includes(season)) | |
.filter(x => x.href.toLowerCase().includes(quality)) | |
.filter(x => x.href.toLowerCase().includes(encoding)) | |
.map(y => y.href).join('\n') | |
console.log(fileContent) | |
const element = document.createElement('a'); | |
element.setAttribute('href', `data:text/plain;charset=utf-8, ${encodeURIComponent(fileContent)}`); | |
element.setAttribute('download', `${showname.replace(/ /g, '-')}.txt`); | |
element.style.display = 'none'; | |
document.body.appendChild(element); | |
element.click(); | |
document.body.removeChild(element); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment