New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

itunes-web-api

Package Overview
Dependencies
Maintainers
3
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

itunes-web-api - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

2

package.json
{
"name": "itunes-web-api",
"version": "1.0.6",
"version": "1.0.7",
"description": "iTunes WEB API Scrapper. Get iTunes track/trackvideo/artist/album/movie/app/book/voicebook/podcast infos with their names.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,18 +5,14 @@ const fetch = require("node-fetch");

async track(songName, options = {}){
if(!songName) return console.log('ERROR: You must enter a Valid Song Name!')
if(options.limit > 200) return console.log("ERROR: Limit number cannot be more than 200.")
if(!songName) throw new TypeError('ERROR: You must enter a Valid Song Name!')
if(options.limit > 200) throw new TypeError("ERROR: Limit number cannot be more than 200.")
if(!options.limit || options.limit === null || options.limit === undefined || options.limit === 0) options.limit = 1
if(isNaN(options.lang) === false) return console.log("ERROR: Language cannot be number.")
if(isNaN(options.lang) === false) throw new TypeError("ERROR: Language cannot be number.")
if(!options.lang || options.lang === null || options.lang === undefined || options.lang === 0) options.lang = 'en'
if(isNaN(options.country) === false) return console.log("ERROR: Country cannot be number.")
if(isNaN(options.country) === false) throw new TypeError("ERROR: Country cannot be number.")
if(!options.country || options.country === null || options.country === undefined || options.country === 0) options.country = 'US'
const res = await fetch(`https://itunes.apple.com/search?term=${encodeURI(songName)}&media=music&limit=${options.limit}&lang=${options.lang}&country=${options.country}`);
const response = await res.json();
if(response.resultCount === 0) {
console.error("ERROR: This Song is doesn't exist.");
return undefined;
}
if(response.resultCount === 0) throw new Error("ERROR: This Song is doesn't exist.");
if(response.errorMessage && options.lang && options.country || response.errorMessage && options.lang || response.errorMessage) {
console.error(`Unspecified Language or Country. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
return undefined;
throw new TypeError(`Unspecified Language or Country or Strings. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
}

@@ -26,18 +22,14 @@ return response;

async trackVideo(songName, options = {}){
if(!songName) return console.log('ERROR: You must enter a Valid Song Name!')
if(options.limit > 200) return console.log("ERROR: Limit number cannot be more than 200.")
if(!songName) throw new TypeError('ERROR: You must enter a Valid Song Name!')
if(options.limit > 200) throw new TypeError("ERROR: Limit number cannot be more than 200.")
if(!options.limit || options.limit === null || options.limit === undefined || options.limit === 0) options.limit = 1
if(isNaN(options.lang) === false) return console.log("ERROR: Language cannot be number.")
if(isNaN(options.lang) === false) throw new TypeError("ERROR: Language cannot be number.")
if(!options.lang || options.lang === null || options.lang === undefined || options.lang === 0) options.lang = 'en'
if(isNaN(options.country) === false) return console.log("ERROR: Country cannot be number.")
if(isNaN(options.country) === false) throw new TypeError("ERROR: Country cannot be number.")
if(!options.country || options.country === null || options.country === undefined || options.country === 0) options.country = 'US'
const res = await fetch(`https://itunes.apple.com/search?term=${encodeURI(songName)}&media=musicVideo&limit=${options.limit}&lang=${options.lang}&country=${options.country}`);
const response = await res.json();
if(response.resultCount === 0) {
console.error("ERROR: This Song is doesn't exist.");
return undefined;
}
if(response.resultCount === 0) throw new Error("ERROR: This Song is doesn't exist.") ;
if(response.errorMessage && options.lang && options.country || response.errorMessage && options.lang || response.errorMessage) {
console.error(`Unspecified Language or Country. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
return undefined;
throw new TypeError(`Unspecified Language or Country or Strings. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
}

@@ -47,18 +39,14 @@ return response;

async artist(artistName, options = {}){
if(!artistName) return console.log('ERROR: You must enter a Valid Album Name!')
if(options.limit > 200) return console.log("ERROR: Limit number cannot be more than 200.")
if(!artistName) throw new TypeError('ERROR: You must enter a Valid Album Name!')
if(options.limit > 200) throw new TypeError("ERROR: Limit number cannot be more than 200.")
if(!options.limit || options.limit === null || options.limit === undefined || options.limit === 0) options.limit = 1
if(isNaN(options.lang) === false) return console.log("ERROR: Language cannot be number.")
if(isNaN(options.lang) === false) throw new TypeError("ERROR: Language cannot be number.")
if(!options.lang || options.lang === null || options.lang === undefined || options.lang === 0) options.lang = 'en'
if(isNaN(options.country) === false) return console.log("ERROR: Country cannot be number.")
if(isNaN(options.country) === false) throw new TypeError("ERROR: Country cannot be number.")
if(!options.country || options.country === null || options.country === undefined || options.country === 0) options.country = 'US'
const res = await fetch(`https://itunes.apple.com/search?term=${encodeURI(artistName)}&entity=allArtist&attribute=allArtistTerm&limit=${options.limit}&lang=${options.lang}&country=${options.country}`);
const response = await res.json();
if(response.resultCount === 0) {
console.error("ERROR: This Album is doesn't exist.");
return undefined;
}
if(response.resultCount === 0) throw new Error("ERROR: This Artist is doesn't exist.");
if(response.errorMessage && options.lang && options.country || response.errorMessage && options.lang || response.errorMessage) {
console.error(`Unspecified Language or Country. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
return undefined;
throw new TypeError(`Unspecified Language or Country or Strings. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
}

@@ -68,18 +56,14 @@ return response;

async album(albumName, options = {}){
if(!albumName) return console.log('ERROR: You must enter a Valid Album Name!')
if(options.limit > 200) return console.log("ERROR: Limit number cannot be more than 200.")
if(!albumName) throw new TypeError('ERROR: You must enter a Valid Album Name!')
if(options.limit > 200) throw new TypeError("ERROR: Limit number cannot be more than 200.")
if(!options.limit || options.limit === null || options.limit === undefined || options.limit === 0) options.limit = 1
if(isNaN(options.lang) === false) return console.log("ERROR: Language cannot be number.")
if(isNaN(options.lang) === false) throw new TypeError("ERROR: Language cannot be number.")
if(!options.lang || options.lang === null || options.lang === undefined || options.lang === 0) options.lang = 'en'
if(isNaN(options.country) === false) return console.log("ERROR: Country cannot be number.")
if(isNaN(options.country) === false) throw new TypeError("ERROR: Country cannot be number.")
if(!options.country || options.country === null || options.country === undefined || options.country === 0) options.country = 'US'
const res = await fetch(`https://itunes.apple.com/search?term=${encodeURI(albumName)}&entity=album&limit=${options.limit}&lang=${options.lang}&country=${options.country}`);
const response = await res.json();
if(response.resultCount === 0) {
console.error("ERROR: This Album is doesn't exist.");
return undefined;
}
if(response.resultCount === 0) throw new Error("ERROR: This Album is doesn't exist.");
if(response.errorMessage && options.lang && options.country || response.errorMessage && options.lang || response.errorMessage) {
console.error(`Unspecified Language or Country. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
return undefined;
throw new TypeError(`Unspecified Language or Country or Strings. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
}

@@ -89,18 +73,14 @@ return response;

async app(appName, options = {}){
if(!appName) return console.log('ERROR: You must enter a Valid App Name!')
if(options.limit > 200) return console.log("ERROR: Limit number cannot be more than 200.")
if(!appName) throw new TypeError('ERROR: You must enter a Valid App Name!')
if(options.limit > 200) throw new TypeError("ERROR: Limit number cannot be more than 200.")
if(!options.limit || options.limit === null || options.limit === undefined || options.limit === 0) options.limit = 1
if(isNaN(options.lang) === false) return console.log("ERROR: Language cannot be number.")
if(isNaN(options.lang) === false) throw new TypeError("ERROR: Language cannot be number.")
if(!options.lang || options.lang === null || options.lang === undefined || options.lang === 0) options.lang = 'en'
if(isNaN(options.country) === false) return console.log("ERROR: Country cannot be number.")
if(isNaN(options.country) === false) throw new TypeError("ERROR: Country cannot be number.")
if(!options.country || options.country === null || options.country === undefined || options.country === 0) options.country = 'US'
const res = await fetch(`https://itunes.apple.com/search?term=${encodeURI(appName)}&entity=software&limit=${options.limit}&lang=${options.lang}&country=${options.country}`);
const response = await res.json();
if(response.resultCount === 0) {
console.error("ERROR: This App is doesn't exist.");
return undefined;
}
if(response.resultCount === 0) throw new Error("ERROR: This App is doesn't exist.");
if(response.errorMessage && options.lang && options.country || response.errorMessage && options.lang || response.errorMessage) {
console.error(`Unspecified Language or Country. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
return undefined;
throw new TypeError(`Unspecified Language or Country or Strings. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
}

@@ -110,18 +90,14 @@ return response;

async movie(movieName, options = {}){
if(!movieName) return console.log('ERROR: You must enter a Valid Movie Name!')
if(options.limit > 200) return console.log("ERROR: Limit number cannot be more than 200.")
if(!movieName) throw new TypeError('ERROR: You must enter a Valid Movie Name!')
if(options.limit > 200) throw new TypeError("ERROR: Limit number cannot be more than 200.")
if(!options.limit || options.limit === null || options.limit === undefined || options.limit === 0) options.limit = 1
if(isNaN(options.lang) === false) return console.log("ERROR: Language cannot be number.")
if(isNaN(options.lang) === false) throw new TypeError("ERROR: Language cannot be number.")
if(!options.lang || options.lang === null || options.lang === undefined || options.lang === 0) options.lang = 'en'
if(isNaN(options.country) === false) return console.log("ERROR: Country cannot be number.")
if(isNaN(options.country) === false) throw new TypeError("ERROR: Country cannot be number.")
if(!options.country || options.country === null || options.country === undefined || options.country === 0) options.country = 'US'
const res = await fetch(`https://itunes.apple.com/search?term=${encodeURI(movieName)}&entity=movie&limit=${options.limit}&lang=${options.lang}&country=${options.country}`);
const response = await res.json();
if(response.resultCount === 0) {
console.error("ERROR: This Movie is doesn't exist.");
return undefined;
}
if(response.resultCount === 0) throw new Error("ERROR: This Movie is doesn't exist.");
if(response.errorMessage && options.lang && options.country || response.errorMessage && options.lang || response.errorMessage) {
console.error(`Unspecified Language or Country. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
return undefined;
throw new TypeError(`Unspecified Language or Country or Strings. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
}

@@ -131,18 +107,14 @@ return response;

async book(bookName, options = {}){
if(!bookName) return console.log('ERROR: You must enter a Valid Book Name!')
if(options.limit > 200) return console.log("ERROR: Limit number cannot be more than 200.")
if(!bookName) throw new TypeError('ERROR: You must enter a Valid Book Name!')
if(options.limit > 200) throw new TypeError("ERROR: Limit number cannot be more than 200.")
if(!options.limit || options.limit === null || options.limit === undefined || options.limit === 0) options.limit = 1
if(isNaN(options.lang) === false) return console.log("ERROR: Language cannot be number.")
if(isNaN(options.lang) === false) throw new TypeError("ERROR: Language cannot be number.")
if(!options.lang || options.lang === null || options.lang === undefined || options.lang === 0) options.lang = 'en'
if(isNaN(options.country) === false) return console.log("ERROR: Country cannot be number.")
if(isNaN(options.country) === false) throw new TypeError("ERROR: Country cannot be number.")
if(!options.country || options.country === null || options.country === undefined || options.country === 0) options.country = 'US'
const res = await fetch(`https://itunes.apple.com/search?term=${encodeURI(bookName)}&entity=ebook&limit=${options.limit}&lang=${options.lang}&country=${options.country}`);
const response = await res.json();
if(response.resultCount === 0) {
console.error("ERROR: This Book is doesn't exist.");
return undefined;
}
if(response.resultCount === 0) throw new Error("ERROR: This Book is doesn't exist.");
if(response.errorMessage && options.lang && options.country || response.errorMessage && options.lang || response.errorMessage) {
console.error(`Unspecified Language or Country. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
return undefined;
throw new TypeError(`Unspecified Language or Country or Strings. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
}

@@ -152,18 +124,14 @@ return response;

async voicebook(voicebookName, options = {}){
if(!voicebookName) return console.log('ERROR: You must enter a Valid Voice Book Name!')
if(options.limit > 200) return console.log("ERROR: Limit number cannot be more than 200.")
if(!voicebookName) throw new TypeError('ERROR: You must enter a Valid Voice Book Name!')
if(options.limit > 200) throw new TypeError("ERROR: Limit number cannot be more than 200.")
if(!options.limit || options.limit === null || options.limit === undefined || options.limit === 0) options.limit = 1
if(isNaN(options.lang) === false) return console.log("ERROR: Language cannot be number.")
if(isNaN(options.lang) === false) throw new TypeError("ERROR: Language cannot be number.")
if(!options.lang || options.lang === null || options.lang === undefined || options.lang === 0) options.lang = 'en'
if(isNaN(options.country) === false) return console.log("ERROR: Country cannot be number.")
if(isNaN(options.country) === false) throw new TypeError("ERROR: Country cannot be number.")
if(!options.country || options.country === null || options.country === undefined || options.country === 0) options.country = 'US'
const res = await fetch(`https://itunes.apple.com/search?term=${encodeURI(voicebookName)}&entity=audiobook&limit=${options.limit}&lang=${options.lang}&country=${options.country}`);
const response = await res.json();
if(response.resultCount === 0) {
console.error("ERROR: This Voice Book is doesn't exist.");
return undefined;
}
if(response.resultCount === 0) throw new Error("ERROR: This Voice Book is doesn't exist.");
if(response.errorMessage && options.lang && options.country || response.errorMessage && options.lang || response.errorMessage) {
console.error(`Unspecified Language or Country. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
return undefined;
throw new TypeError(`Unspecified Language or Country or Strings. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
}

@@ -173,18 +141,14 @@ return response;

async podcast(podcastName, options = {}){
if(!podcastName) return console.log('ERROR: You must enter a Valid Podcast Name!')
if(options.limit > 200) return console.log("ERROR: Limit number cannot be more than 200.")
if(!podcastName) throw new TypeError('ERROR: You must enter a Valid Podcast Name!')
if(options.limit > 200) throw new TypeError("ERROR: Limit number cannot be more than 200.")
if(!options.limit || options.limit === null || options.limit === undefined || options.limit === 0) options.limit = 1
if(isNaN(options.lang) === false) return console.log("ERROR: Language cannot be number.")
if(isNaN(options.lang) === false) throw new TypeError("ERROR: Language cannot be number.")
if(!options.lang || options.lang === null || options.lang === undefined || options.lang === 0) options.lang = 'en'
if(isNaN(options.country) === false) return console.log("ERROR: Country cannot be number.")
if(isNaN(options.country) === false) throw new TypeError("ERROR: Country cannot be number.")
if(!options.country || options.country === null || options.country === undefined || options.country === 0) options.country = 'US'
const res = await fetch(`https://itunes.apple.com/search?term=${encodeURI(podcastName)}&entity=podcast&limit=${options.limit}&lang=${options.lang}&country=${options.country}`);
const response = await res.json();
if(response.resultCount === 0) {
console.error("ERROR: This Podcast is doesn't exist.");
return undefined;
}
if(response.resultCount === 0) throw new Error("ERROR: This Podcast is doesn't exist.");
if(response.errorMessage && options.lang && options.country || response.errorMessage && options.lang || response.errorMessage) {
console.error(`Unspecified Language or Country. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
return undefined;
throw new TypeError(`Unspecified Language or Country or Strings. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
}

@@ -194,22 +158,18 @@ return response;

async searchAll(searchString, entity, attribute, options = {}){
if(!searchString) return console.log('ERROR: You must enter a string for search!')
if(!entity) return console.log('ERROR: You must enter a entity! Example entitys = (movie, album, allArtist, podcast, musicVideo, mix, audiobook, tvSeason, allTrack)')
if(isNaN(entity) === false) return console.log("ERROR: Entity cannot be number.")
if(!attribute) return console.log('ERROR: You must enter a attribute! Example attributes = (actorTerm, languageTerm, allArtistTerm, tvEpisodeTerm, shortFilmTerm, directorTerm, releaseYearTerm, titleTerm, featureFilmTerm, ratingIndex, keywordsTerm, descriptionTerm, authorTerm, genreIndex, mixTerm, allTrackTerm, artistTerm, composerTerm, tvSeasonTerm, producerTerm, ratingTerm, songTerm, movieArtistTerm, showTerm, movieTerm, albumTerm)')
if(isNaN(attribute) === false) return console.log("ERROR: Attribute cannot be number.")
if(options.limit > 200) return console.log("ERROR: Limit number cannot be more than 200.")
if(!searchString) throw new TypeError('ERROR: You must enter a string for search!')
if(!entity) throw new TypeError('ERROR: You must enter a entity! Example entitys = (movie, album, allArtist, podcast, musicVideo, mix, audiobook, tvSeason, allTrack)')
if(isNaN(entity) === false) throw new TypeError("ERROR: Entity cannot be number.")
if(!attribute) throw new TypeError('ERROR: You must enter a attribute! Example attributes = (actorTerm, languageTerm, allArtistTerm, tvEpisodeTerm, shortFilmTerm, directorTerm, releaseYearTerm, titleTerm, featureFilmTerm, ratingIndex, keywordsTerm, descriptionTerm, authorTerm, genreIndex, mixTerm, allTrackTerm, artistTerm, composerTerm, tvSeasonTerm, producerTerm, ratingTerm, songTerm, movieArtistTerm, showTerm, movieTerm, albumTerm)')
if(isNaN(attribute) === false) throw new TypeError("ERROR: Attribute cannot be number.")
if(options.limit > 200) throw new TypeError("ERROR: Limit number cannot be more than 200.")
if(!options.limit || options.limit === null || options.limit === undefined || options.limit === 0) options.limit = 1
if(isNaN(options.lang) === false) return console.log("ERROR: Language cannot be number.")
if(isNaN(options.lang) === false) throw new TypeError("ERROR: Language cannot be number.")
if(!options.lang || options.lang === null || options.lang === undefined || options.lang === 0) options.lang = 'en'
if(isNaN(options.country) === false) return console.log("ERROR: Country cannot be number.")
if(isNaN(options.country) === false) throw new TypeError("ERROR: Country cannot be number.")
if(!options.country || options.country === null || options.country === undefined || options.country === 0) options.country = 'US'
const res = await fetch(`https://itunes.apple.com/search?term=${searchString}&entity=${entity}&attribute=${attribute}&limit=${options.limit}&lang=${options.lang}&country=${options.country}`);
const response = await res.json();
if(response.resultCount === 0) {
console.error("ERROR: Resulsts are doesn't exist.");
return undefined;
}
if(response.resultCount === 0) throw new Error("ERROR: Resulsts are doesn't exist.");
if(response.errorMessage && options.lang && options.country || response.errorMessage && options.lang || response.errorMessage) {
console.error(`Unspecified Language or Country or Strings. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
return undefined;
throw new TypeError(`Unspecified Language or Country or Strings. ERROR: ${response.errorMessage}\nPlease Check https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2`);
}

@@ -216,0 +176,0 @@ return response;

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc