This is a REST API for converting Youtube videos to mp3 files with metadata (tags) and album cover art using youtube-dl and ffmpeg. Please use alongside with @brunight/youtube-dl-web.
- NodeJS and NPM or Yarn;
Linux and MacOS:
In Windows, since youtube-dl does not need Python to work, the API will try to download it and save to bin/youtube-dl.exe.
In Linux and MacOS, you'll need to manually install Python version 2.6, 2.7, or 3.2+ and youtube-dl. Follow the instructions in the links above. If you already have youtube-dl binarie installed, see Configuration to know how to set it.
With npm do:
npm installOr with yarn do:
yarn installYou can set the directories where files will be generated and the path for youtube-dl binarie with Environment Variables. Create a file named .env in project root and put there your configuration. For examples, check .env.example. If no temp directory is provided, it'll be created at project root.
To start with npm do:
npm run dev:serverOr with yarn do:
yarn dev:serverYou really should use the React web interface recommended above with this API, directly accessing it can be troublesome at the time.
The API's main route is POST /youtube, with parameters:
- id: Youtube video id.
- title: Music title.
- artist: Music artist.
- album: Music album.
- comment: Music comment (usually original video's link).
- cover (optional): Url of album cover art.
- startTime (optional): Start time. Ex: 00:00:30.000.
- endTime (optional): End time. Ex: 00:04:30.000.
- duration (optional): End time - start time. Ex: 00:04:00.000.
If successful, filename will be returned:
{
"fileName": "Artist - Title.mp3"
}You can also use POST /cover route to upload album cover art to server with parameter cover.
- TypeScript;
- Express;
- Multer;
- fluent-ffmpeg;
- youtube-dl-wrap;
- ffmetadata (file metadata reading only);
- ESLint;
- Prettier;
- DotEnv;
Check in @brunight/youtube-dl-web.
MIT. Not recommended to use with copyrighted content. Developed by Bruno Rodrigues.