Skip to content

Instantly share code, notes, and snippets.

@oddoye-david
Last active February 16, 2019 11:31
Show Gist options
  • Save oddoye-david/186deb219b1d1d8f8c69458f5046cf89 to your computer and use it in GitHub Desktop.
Save oddoye-david/186deb219b1d1d8f8c69458f5046cf89 to your computer and use it in GitHub Desktop.
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