Updates any old/expired Discord download links.
There are two ways to use the HTTP server
Simply paste the Discord URL at the end of your server URL
http://localhost/https://cdn.discordapp.com/attachments/763509665585561610/1216965708911480923/image.png
Replace the cdn.discord.app.com
with your URL. Make sure to change HTTPS
to HTTP
unless you have configured HTTPS
through something like CloudFlare.
http://localhost/attachments/763509665585561610/1216965708911480923/image.png
If you wish to use Discord CDN as a library, check the code example below.
You may also check src/server.ts
to see how the HTTP server uses it.
import { Discord, getConfig } from "PATH_TO_DISCORD_CDN"
//getConfig will parse the config from .env
//if you wish to pass your own config object, check the `src/Types/IConfig.ts` interface
async function dev() {
try {
let config = await getConfig();
let discord = new Discord(config);
let link = await discord.fetchLatestLink("https://cdn.discordapp.com/attachments/763509665585561610/1216965708911480923/image.png?ex=")
console.log(link);
} catch (ex) {
console.error(ex);
}
}
dev();
git clone https://github.com/ShufflePerson/Discord_CDN.git
cd Discord_CDN
Download the repo as a zip and extract it to a folder.
Fill the values in the .env.example
and rename .env.example
to simply .env
TOKEN
- A Discord Account Token, used for fetching the link
FALLBACK
- If Discord removes the endpoint for fetching a non-expired link, fallback to the V1 lookup.
PORT
- Specifies what port the HTTP server will be running on.
- Open Discord on your Browser.
- Open the Dev Tools ( Inspect Element )
- Go to the Console Tab and paste in the following command
console.log((webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m=>m?.exports?.default?.getToken!==void 0).exports.default.getToken());
- Copy the output and set it in the
.env
file. (e.gTOKEN=PASTE_TOKEN_HERE
)
yarn install
yarn pnpify tsc
yarn node ./dist/server.js
npm run setup
This will also recompile the code.
npm run start
You may contact me on my Discord: _.shuffle._