Created
May 26, 2020 17:21
-
-
Save alexmercerind/e6e60566c62825c9e8f3496bfed54042 to your computer and use it in GitHub Desktop.
Script to search music in JioSaavn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//github.com/alexmercerind | |
let axios = require('axios'); | |
function search(mode, keyword) { | |
axios.get(`https://www.jiosaavn.com/search/${mode}/${keyword}`) | |
.then((response, resolve, reject) => { | |
let page_source = (response.data).split(","); | |
let id_array = []; | |
for (let i = 0; i<page_source.length; i++) { | |
let element = page_source[i]; | |
if (element.length == 10 && !isNaN(element[1])) { | |
id_array.push(Number(element.substring(1, element.length-1))); | |
}; | |
}; | |
console.log(id_array); //print album/song id | |
}); | |
}; | |
search("album", "voicenotes"); //search here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment