node-rjdl v3.0.0
Checkout #Mahsa_Amini, Support women of Iran 🇮🇷
Node rjdl
Radio javan scraper / downloader
Install
npm i node-rjdlUsage
Here's a quick guide to start
import * as Rj from "node-rjdl";
const song = await Rj.getMusic("https://rj.app/m/2qKkkB8q");
// {title: ... , artist: ... , ...}
const downloadLinks = await song.getDownloadLinks();
// {midQuality: ... , highQuality: ...}You can use download() as well, for example
const readable = await song.download("hq");
readable.pipe(fs.createWriteStream("song-name.mp3"));Getting link type
Supported for Playlists , Albums , Podcasts , Videos , Musics , TV
const rjType = Rj.getLinkType(
"https://play.radiojavan.com/song/Donya-Bye-Bye-Bye"
);
console.log(rjType === Rj.LinkType.Music); // trueGetting input info
Supported for Playlists , Albums , Podcasts , Musics , Videos
const songInfo = await Rj.getMusic(
"https://play.radiojavan.com/song/Donya-Bye-Bye-Bye"
);
// {title: "Bye Bye Bye" , artist: "Donya" , getDownloadLinks() , ...}Getting download links
Download links will be provided in mid and high qualities. It's common to use these functions when you only need the download links alone. Otherwise, getMusic and other info getters suite you best with both info and download links in an optimized way.
Supported for Musics , Podcasts , Videos
const links = await Rj.getMusicDownloadLinksViaURL(
"https://play.radiojavan.com/song/Donya-Bye-Bye-Bye"
);
console.log(links.midQuality);
// https://host2.rj-mw1.com/media/mp3/mp3-256/Donya-Bye-Bye-Bye.mp3
console.log(links.highQuality);
// https://host2.rj-mw1.com/media/mp3/mp3-320/Donya-Bye-Bye-Bye.mp3You can also use downloadMusicViaURL and similar functions if you prefer to get Readable object
const readable = await Rj.downloadMusicViaURL(
"https://www.play.radiojavan.com/song/Koorosh-Un-Momento-(Ft-Raha)"
);
readable.pipe(fs.createWriteStream("Koorosh-Un-Momento.mp3"));Validating URL
Only the URLs which their link type is recognizable will be considered valid
Rj.validateURL("https://play.radiojavan.com/song/Donya-Bye-Bye-Bye"); // true
Rj.validateURL("https://rj.app/ma/D18eAKwY"); // true
Rj.validateURL("https://google.com"); // false
Rj.validateURL("https://radiojavan.com"); // falseScripts
Building
To get started install the packages
npm installThen you'll be able to use the build script
npm run buildTesting
For all tests
npm testFor unit and integration tests only
npm run unitTestFor end to end tests only (ending with .test.e2e.ts)
npm run e2eTest