Last active
May 22, 2021 06:25
-
-
Save Hans5958/92e45fa046ed7198137ed149a342cf85 to your computer and use it in GitHub Desktop.
Searches links on Discord. For ripping pictures/attachments.
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
var links = [] | |
var messages = document.getElementsByClassName("messages")[0] | |
var startLinks | |
var endLinks | |
function check() { | |
startLinks = links.length | |
array = document.getElementsByTagName("a") | |
for (i = 0; i < array.length; i++) { | |
if (links.includes(array[i].href) == false) { | |
console.log(array[i].href) | |
links.push(array[i].href) | |
} | |
} | |
endLinks = links.length - startLinks | |
} | |
function loadMore() { | |
a = document.getElementsByTagName("button") | |
for (i = 0; i < a.length; i++) { | |
if (a[i].innerHTML == "Load more messages") {a[i].click()} | |
} | |
} | |
function upAway() { | |
loadMore(); | |
if(messages.scrollTop == 0) { | |
if (document.getElementsByClassName("base-34jWEe").length == 0) { | |
window.setTimeout(upAway, 1000); | |
} else { | |
console.log("[ACTIVITY] Top found. End of loop.") | |
} | |
} else { | |
console.log("[ACTIVITY] Finding links...") | |
check(); | |
console.log("[ACTIVITY] Found " + endLinks + " new unique links.") | |
console.log("[ACTIVITY] Links found: " + links.length) | |
messages.scrollTop = 0 | |
window.setTimeout(upAway, 1000); | |
} | |
} | |
upAway(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment