Socket
Socket
Sign inDemoInstall

azlyrics

Package Overview
Dependencies
61
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 2.0.0

109

index.js

@@ -8,3 +8,3 @@ /*

// Requires
const request = require('sync-request');
const request = require('request');
const cheerio = require('cheerio');

@@ -48,19 +48,22 @@ // Constant

var URI = artistUrl(artistName);
// Get the response
var Response = request('GET', URI);
// Parse the body
var $ = cheerio.load(Response.getBody());
// Get the album list
var albumList = $('.album > b');
// Start pushing to the array
var returnValue = [];
for(var index = 0; index < albumList.length; index++)
{
// Remove the trailing "-s
var albumName = albumList[index].children[0].data.substr(1).slice(0, -1);
// Append the album name to the list
returnValue.push(albumName);
}
// Return the array
return returnValue;
return new Promise(r => {
// Get the response
request(URI, (error,response,body) => {
// Parse the body
var $ = cheerio.load(body);
// Get the album list
var albumList = $('.album > b');
// Start pushing to the array
var returnValue = [];
for(var index = 0; index < albumList.length; index++)
{
// Remove the trailing "-s
var albumName = albumList[index].children[0].data.substr(1).slice(0, -1);
// Append the album name to the list
returnValue.push(albumName);
}
// Return the array
r(returnValue);
});
});
}

@@ -71,18 +74,21 @@ // Gets the songs from a specified artist

var URI = artistUrl(artistName);
// Get the response
var Response = request('GET', URI);
// Parse the body
var $ = cheerio.load(Response.getBody());
// Get the song list
var songList = $("#listAlbum > a[href]");
// Start pushing to the array
var returnValue = [];
for(var index = 0; index < songList.length; index++)
{
var songName = songList[index].children[0].data;
// Append the song name to the list
returnValue.push(songName);
}
// Return the array
return returnValue;
return new Promise(r => {
// Get the response
var Response = request(URI,(error,response,body) => {
// Parse the body
var $ = cheerio.load(body);
// Get the song list
var songList = $("#listAlbum > a[href]");
// Start pushing to the array
var returnValue = [];
for(var index = 0; index < songList.length; index++)
{
var songName = songList[index].children[0].data;
// Append the song name to the list
returnValue.push(songName);
}
// Return the array
r(returnValue);
});
});
}

@@ -93,18 +99,21 @@ // Gets the lyrics for a song, artist must be specified

var URI = lyricsUrl(artistName,songName);
// Get the response
var Response = request('GET', URI);
// Parse the body
var $ = cheerio.load(Response.getBody());
// Get the lyrics
var lyricsDiv = $(".col-xs-12.col-lg-8.text-center")[0].children[16].children;
// Start getting the lyrics
var lyrics = lyricsDiv[2].data.substr(1)+"\n";
for(var index = 4; index < lyricsDiv.length; index+=2)
{
var line = lyricsDiv[index].data.substr(1)+"\n";
lyrics += line;
}
lyrics = lyrics.slice(0,-2);
// Return the lyrics
return lyrics;
return new Promise(r => {
// Get the response
var Response = request(URI,(error,response,body) => {;
// Parse the body
var $ = cheerio.load(body);
// Get the lyrics
var lyricsDiv = $(".col-xs-12.col-lg-8.text-center")[0].children[16].children;
// Start getting the lyrics
var lyrics = lyricsDiv[2].data.substr(1)+"\n";
for(var index = 4; index < lyricsDiv.length; index+=2)
{
var line = lyricsDiv[index].data.substr(1)+"\n";
lyrics += line;
}
lyrics = lyrics.slice(0,-2);
// Return the lyrics
r(lyrics);
});
});
}
{
"name": "azlyrics",
"version": "1.0.2",
"version": "2.0.0",
"description": "An AzLyrics API",

@@ -25,4 +25,4 @@ "main": "index.js",

"cheerio": "^1.0.0-rc.2",
"sync-request": "^4.1.0"
"request": "^2.85.0"
}
}
### azlyrics.js
`azlyrics.js` is a NodeJS package that interacts with the [AZLyrics](https://azlyrics.com/) website.
All methods return promises which resolve different things.
## Supported methods
| Name | Returns | Arguments |
| Name | Resolves | Arguments |
| ------------- |:-------------:| -----:|

@@ -6,0 +7,0 @@ | getAlbums | Array | (artistName : String) |

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc