A method that will allow you to search an Artist
Parameter | Type | Required | Description |
---|---|---|---|
searchTerm | string | ✅ | The search term used look for an artist that matches that value |
options | object | 🔴 | Options used to parametrize the search |
Options Object
If you do not enter limit, lang or country values, the default language and country code are set to English. Limit Number default is 1. Please Check ISO 3166 For Language and Country Codes.
Key | Type | Required | Description | Default Value |
---|---|---|---|---|
limit | number | ✅ | Required if options is defined. A Numeric value that sets the limit of results by the search term | 1 |
language | string | 🔴 | a language code based on ISO 639-1 | "en" |
country | string | 🔴 | a country code based on ISO 3166 | "US" |
timeout | number | 🔴 | The amout of milliseconds that will be allowed the search to take before timeout. | 2000 |
const { searchArtist } = require('@tbogard/itunes-search');
const search = async () => {
const result = await searchArtist('Juanes', {
limit: 3,
});
console.log(result);
};
search();
<script src="itunesSearch.min.js"></script>
<script type="text/javascript">
const { searchArtist } = iTunesSearch;
const search = async () => {
const result = await searchArtist('Juanes', {
limit: 3,
});
console.log(result);
};
search();
</script>
{
"resultCount": 3,
"results": [
{
"wrapperType": "artist",
"artistType": "Artist",
"artistName": "Juanes",
"artistLinkUrl": "https://music.apple.com/us/artist/juanes/103856?uo=4",
"artistId": 103856,
"amgArtistId": 451494,
"primaryGenreName": "Pop Latino",
"primaryGenreId": 1117
},
{
"wrapperType": "artist",
"artistType": "Software Artist",
"artistName": "Cesar de Juanes Sanchez",
"artistLinkUrl": "https://apps.apple.com/us/developer/cesar-de-juanes-sanchez/id1505971612?uo=4",
"artistId": 1505971612
},
{
"wrapperType": "artist",
"artistType": "Artist",
"artistName": "José Juanes",
"artistLinkUrl": "https://music.apple.com/us/artist/jos%C3%A9-juanes/959515520?uo=4",
"artistId": 959515520,
"primaryGenreName": "Worldwide",
"primaryGenreId": 19
}
]
}
API
searchAlbum | searchAll | searchApp | searchArtist | searchAudiobook | searchBook | searchMovie | searchMusicVideo | searchPodcast | searchSong