Members

(readonly) LinkType

Music links enum

Properties
NameTypeDescription
Music0

Music type

Playlist1

Playlist type

Album2

Album type

Video3

Video type

Podcast4

Podcast type

TV5

TV type

Methods

downloadMusicViaURL(url, qualityopt) → {Promise.<Readable>}

Used to download music via its URL

Parameters:
NameTypeAttributesDefaultDescription
urlstring

Music's url

quality"hq" | "lq"<optional>
hq

Music quality

Returns:
Type: 
Promise.<Readable>
Example
const readable = await Rj.downloadMusicViaURL("https://play.radiojavan.com/song/Koorosh-Un-Momento-(Ft-Raha)")
readable.pipe(fs.createWriteStream("Koorosh-Un-Momento.mp3"))

downloadPodcastViaURL(url, qualityopt) → {Promise.<Readable>}

Used to download podcast via its URL

Parameters:
NameTypeAttributesDefaultDescription
urlstring

Podcast's url

quality"hq" | "lq"<optional>
hq

Podcast quality Bear in mind that sometimes lq and hq qualities can be the same

Returns:
Type: 
Promise.<Readable>
Example
const readable = await Rj.downloadPodcastViaURL("https://play.radiojavan.com/podcast/Abo-Atash-119")
readable.pipe(fs.createWriteStream("Abo-Atash-119.mp3")

downloadVideoViaURL(url, qualityopt) → {Promise.<Readable>}

Used to download video via its URL

Parameters:
NameTypeAttributesDefaultDescription
urlstring

Video's url

quality"hq" | "lq"<optional>
hq

Video quality

Returns:
Type: 
Promise.<Readable>
Example
const readable = await Rj.downloadVideoViaURL("https://play.radiojavan.com/video/gdaal-madgal-banafsh")
readable.pipe(fs.createWriteStream("gdaal-madgal-banafsh.mp4")

formatURL(url) → {string}

Used to format a radio javan url into a standard form

Parameters:
NameTypeDescription
urlstring
Returns:

Formatted url

Type: 
string
Example
const formatted = Rj.formatURL("www.play.radiojavan.com/song");
console.log(formatted) // https://play.radiojavan.com/song

getAlbum(url) → {Promise.<AlbumInfo>}

Used to get album info based on its url

Parameters:
NameTypeDescription
urlstring

Album's url

Returns:
Type: 
Promise.<AlbumInfo>
Example
const info = await Rj.getAlbum("https://play.radiojavan.com/album/Koorosh-420")
console.log(info.title) // "420"
console.log(info.artist) // "Koorosh"
console.log(info.tracks) // [ AlbumTrack , ... ]

getLinkType(url) → {LinkType}

Used to get url link type

Parameters:
NameTypeDescription
urlstring
Returns:
Type: 
LinkType
Example
const type = Rj.getLinkType("https://radiojavan.com/mp3s/mp3/Koorosh-Greenwich-(Ft-Salaar)")
console.log(type === Rj.LinkType.Music) // true

getMusic(url) → {Promise.<Music>}

Used to get music info and provide an optimized getDownloadLinks function

Parameters:
NameTypeDescription
urlstring
Returns:
Type: 
Promise.<Music>
Example
const music = await Rj.getMusic("https://play.radiojavan.com/song/Koorosh-Yebaram-Man-(Ft-Arta-Behzad-Leito-Raha)");
console.log(music.title); // Yebaram Man

const downloadLinks = await music.getDownloadLinks();
console.log(downloadLinks.midQuality) // mid quality download link (256)

getMusicDownloadLinksViaURL(url) → {Promise.<DownloadLinks>}

Used to get music download links via its url

Parameters:
NameTypeDescription
urlstring

Music's url

Returns:
Type: 
Promise.<DownloadLinks>
Example
const links = await Rj.getMusicDownloadLinksViaURL("https://play.radiojavan.com/song/Koorosh-Yebaram-Man-(Ft-Arta-Behzad-Leito-Raha)")

// mid quality download link (256)
console.log(links.midQuality)

// high quality download link (320)
console.log(links.highQuality)

getPlaylist(url) → {Promise.<PlaylistInfo>}

Used to get playlist info based on its url

Parameters:
NameTypeDescription
urlstring

Playlist's url

Returns:
Type: 
Promise.<PlaylistInfo>
Example
const info = await Rj.getPlaylist("https://play.radiojavan.com/playlist/mp3/dec52eeff468")
console.log(info.title) // "Acoustic"
console.log(info.creator) // "Radio Javan"
console.log(info.tracks) // [ Track , ... ]

getPodcast(url) → {Promise.<Podcast>}

Used to get podcast info and provide an optimized getDownloadLinks function

Parameters:
NameTypeDescription
urlstring
Returns:
Type: 
Promise.<Podcast>
Example
const podcast = await Rj.getPodcast("https://play.radiojavan.com/podcast/Dance-Station-35");
console.log(podcast.title); // Dance Station 35

const downloadLinks = await podcast.getDownloadLinks();
console.log(downloadLinks.midQuality) // mid quality download link (192)

getPodcastDownloadLinksViaURL(url) → {Promise.<DownloadLinks>}

Used to get podcast download links via its url

Bear in mind that sometimes mid and high qualities can be the same

Parameters:
NameTypeDescription
urlstring

Podcast's url

Returns:
Type: 
Promise.<DownloadLinks>
Example
const links = await Rj.getPodcastDownloadLinksViaURL("https://play.radiojavan.com/podcast/Dance-Station-35")

// mid quality download link (192)
console.log(links.midQuality)

// high quality download link (320)
console.log(links.highQuality)

getVideo(url) → {Promise.<Video>}

Used to get video info and provide an optimized getDownloadLinks function

Parameters:
NameTypeDescription
urlstring
Returns:
Type: 
Promise.<Video>
Example
const video = await Rj.getVideo("https://play.radiojavan.com/video/donya-bye-bye-bye");
console.log(video.title); // Bye Bye Bye

const downloadLinks = await video.getDownloadLinks();
console.log(downloadLinks.midQuality) // mid quality download link

getVideoDownloadLinksViaURL(url) → {Promise.<DownloadLinks>}

Used to get video download links via its url

Parameters:
NameTypeDescription
urlstring

Video's url

Returns:
Type: 
Promise.<DownloadLinks>
Example
const links = await Rj.getVideoDownloadLinksViaURL("https://play.radiojavan.com/video/donya-bye-bye-bye")

// mid quality download link
console.log(links.midQuality)

// high quality download link
console.log(links.highQuality)

validateURL(url) → {boolean}

Used to check whether the url is valid or not

Only the urls which their type is recognizable are considered valid

Recognizable types are defiled in LinkType

Parameters:
NameTypeDescription
urlstring
Returns:
Type: 
boolean

Type Definitions

Properties
NameTypeDescription
midQualitystring

Middle quality download link

highQualitystring

high quality download link