Created
February 21, 2023 22:07
-
-
Save KlissmanGranados/d3e0b3825978603c4d3d483358ba1552 to your computer and use it in GitHub Desktop.
This file contains 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
async function getUri(uri) { | |
const response = await fetch(uri); | |
const response_1 = await response.text(); | |
const document = new DOMParser().parseFromString(response_1, "text/html"); | |
const [download] = [...document.querySelectorAll("#DwsldCn a")].filter(btn => /zippyshare/.test(btn.href)); | |
return download.href; | |
} | |
async function saveUris() { | |
let data = [...document.querySelectorAll("#episodeList a")].map(({ href }) => getUri(href)); | |
data = await Promise.all(data); | |
data = data.join("\n"); | |
const link = document.createElement('a'); | |
link.download = 'links.txt'; | |
const blob = new Blob([data], { type: 'text/plain' }); | |
link.href = window.URL.createObjectURL(blob); | |
link.click(); | |
} | |
saveUris(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment