Invidious (website, github) is an alternative front-end to YouTube written in Crystal that exposes an API usable by other applications to easily obtain data from YouTube without using the official YouTube APIs.
Because I was frustrated at the slow speed, pointless bandwidth consumption and high memory usage of Invidious.
- Data returned much faster compared to Invidious
- Easier to run, since Crystal can be a pain to use
- No pointless bandwidth consumption
- Lower memory usage
- Many more endpoints
- More data returned from each endpoint
- In api/video.js:
/api/v1/videos/{id}
- In api/channel.js:
/api/v1/channels/{id}
/api/v1/channels/{id}/videos
/api/v1/search
/api/v1/playlists/{id}
- Clone the repo
npm install
- Create
db/main.db
according to the schema indb/main-schema.sql
. - If you want to use HTTPS, first obtain a Let's Encrypt certificate, then change
hostnames
inindex.js
. If you don't want to use HTTPS or just want to run the site behind a LAN, you don't have to change the hostname. - Set the ports to use at the top of
index.js
.
Directory | Purpose |
---|---|
api | API modules |
db | Database files |
util | Server utilities needed in more than one file |
I use Visual Studio Code to create this, but of course you may use whatever text editor you like.
Be sure to follow these guidelines for writing and formatting your code:
- End lines with semicolons, (optional for multi-line strings and lines that are entirely closing brackets)
- Indent either with 4 spaces, or a tab character
- Indent where it makes sense
- Curly braces go on the same line as the
if
orfunction
- Strings are delimited with double quotes or backticks, not single quotes
- Use
let
orconst
instead ofvar
where possible - If logging strings, use
cf.log
rather thanconsole.log
Please try to keep the number of node modules to a minimum. Only install another module if you really need to.
Fork the repo, edit the code, open a pull request.
Consider opening an issue first to see whether what you want to change is actually something that I want to merge in.