Giter Site home page Giter Site logo

keivan-sf / rjdl Goto Github PK

View Code? Open in Web Editor NEW
19.0 2.0 1.0 959 KB

Radio Javan downloader and info scraper for Node.js

Home Page: https://keivan-sf.github.io/rjdl

JavaScript 0.24% TypeScript 18.23% Shell 0.09% HTML 81.44%
downloader nodejs radiojavan radiojavan-downloader scraper

rjdl's Introduction

node rjdl

โš ๏ธ This library currently does not work due to Rj latest changes

Node rjdl

Radio javan scraper / downloader

Docs keivan-sf.github.io/rjdl

Install

npm i node-rjdl

Usage

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); // true

Getting 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.mp3

You 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"); // false

Scripts

Building

To get started install the packages

npm install

Then you'll be able to use the build script

npm run build

Testing

For all tests

npm test

For unit and integration tests only

npm run unitTest

For end to end tests only (ending with .test.e2e.ts)

npm run e2eTest

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.