Giter Club home page Giter Club logo

discord_cdn's Introduction

Discord

Discord CDN V2

Updates any old/expired Discord download links.

Graph

Usage

There are two ways to use the HTTP server

Way 1

Simply paste the Discord URL at the end of your server URL

http://localhost/https://cdn.discordapp.com/attachments/763509665585561610/1216965708911480923/image.png

Way 2

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

Using as a Library

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();

Installation and Setup

Download the repo

git clone https://github.com/ShufflePerson/Discord_CDN.git
cd Discord_CDN

OR

Download the repo as a zip and extract it to a folder.

Setup Environment file ( .env )

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.

How to get your token

  1. Open Discord on your Browser.
  2. Open the Dev Tools ( Inspect Element )
  3. Go to the Console Tab and paste in the following command
  4. 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());
  5. Copy the output and set it in the .env file. (e.g TOKEN=PASTE_TOKEN_HERE)

Yarn

Install packages

yarn install

Start the server

yarn pnpify tsc
yarn node ./dist/server.js

NPM

Install packages

npm run setup

Start the server

This will also recompile the code.

npm run start

Contact

You may contact me on my Discord: _.shuffle._

discord_cdn's People

Contributors

shuffleperson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

discord_cdn's Issues

This is not the tsc command you are looking for

Hey, I was trying to build this project locally, however for some reason I'm always facing this error while building it in docker:

                This is not the tsc command you are looking for                
10.50                                                                                
10.50 
10.50 To get access to the TypeScript compiler, tsc, from the command line either:
10.50 
10.50 - Use npm install typescript to first add TypeScript to your project before using npx
10.50 - Use yarn to avoid accidentally running code from un-installed packages
FROM node
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN npm run setup
CMD "npm" "run" "start"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.