scraperjavascript138
Spotify Artist Scraper - Artist Search, Top Tracks, Discography & Audio Preview
Scraper spotify.downloaderize.com/id/artist/: cari artis Spotify, ambil 50 top tracks & diskografi lengkap beserta audio preview MP3.
Vamz Spectre2 Nov 2026248 baris kode
Jalankan via Terminal / CLI:
# 1. Download file script
curl -sL "https://code.vamxapi.my.id/snippet/raw/spotify-artist-downloaderize" -o spotify-artist-downloaderize.js
# 2. Jalankan script
node spotify-artist-downloaderize.js
Dependencies npm yang Dibutuhkan:
npm install axiosPanduan Penggunaan:
// ================================================== // PANDUAN PENGGUNAAN SPOTIFY ARTIST DOWNLOADERIZE // ================================================== // 1. Download Script via CLI: curl -sL "https://code.vamxapi.my.id/snippet/raw/spotify-artist-downloaderize" -o spotify-artist-downloaderize.js // 2. Install Dependensi: npm install axios // 3. Eksekusi via Terminal: node spotify-artist-downloaderize.js search "Coldplay" node spotify-artist-downloaderize.js artist "https://open.spotify.com/artist/4gzpq5DPGxSnKTe4SA8HAU" node spotify-artist-downloaderize.js "Taylor Swift" node spotify-artist-downloaderize.js preview "3AJwUDP919kvQ9QcozQPxg"
spotify-artist-downloaderize.js(248 lines)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
/**
* Spotify Artist Scraper (spotify.downloaderize.com)
* Author: Vamz Spectre / VamxAPI
*
* Install dependencies:
* npm install axios
*
* Download via CLI:
* curl -sL "https://code.vamxapi.my.id/snippet/raw/spotify-artist-downloaderize" -o spotify-artist-downloaderize.js
*
* Usage Examples:
* node spotify-artist-downloaderize.js search "Coldplay"
* node spotify-artist-downloaderize.js artist "https://open.spotify.com/artist/4gzpq5DPGxSnKTe4SA8HAU"
* node spotify-artist-downloaderize.js "Taylor Swift"
* node spotify-artist-downloaderize.js preview "3AJwUDP919kvQ9QcozQPxg"
*/
const axios = require('axios');
const BASE_URL = 'https://spotify.downloaderize.com';
const API_PREVIEW_URL = 'https://api.downloaderize.com';
const USER_AGENT =
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36';
const client = axios.create({
baseURL: BASE_URL,
timeout: 15000,
headers: {
'User-Agent': USER_AGENT,
Referer: `${BASE_URL}/id/artist/`,
Accept: 'application/json, text/plain, */*',
'Accept-Language': 'id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7',
},
});
function formatDuration(ms) {
if (!ms || isNaN(ms)) return '00:00';
const totalSeconds = Math.floor(ms / 1000);
const minutes = Math.floor(totalSeconds / 60);
const seconds = totalSeconds % 60;
return `${minutes}:${seconds.toString().padStart(2, '0')}`;
}
function extractSpotifyId(input) {
if (!input) return '';
const trimmed = input.trim();
const match = trimmed.match(/(?:artist|track|album|playlist)\/([a-zA-Z0-9]{22})/);
if (match) return match[1];
if (/^[a-zA-Z0-9]{22}$/.test(trimmed)) return trimmed;
return trimmed;
}
function normalizeSpotifyUrl(input, defaultType = 'artist') {
if (!input) return '';
const trimmed = input.trim();
if (trimmed.startsWith('http://') || trimmed.startsWith('https://')) {
return trimmed;
}
if (trimmed.startsWith('spotify:')) {
const parts = trimmed.split(':');
if (parts.length >= 3) {
return `https://open.spotify.com/${parts[1]}/${parts[2]}`;
}
}
const id = extractSpotifyId(trimmed);
return `https://open.spotify.com/${defaultType}/${id}`;
}
/**
* Search Spotify for artists, tracks, albums, or playlists
* @param {string} query
* @param {'artist'|'track'|'album'|'playlist'} type
* @param {number} limit
* @param {number} offset
*/
async function search(query, type = 'artist', limit = 10, offset = 0) {
if (!query) throw new Error('Query pencarian wajib diisi.');
const res = await client.get('/search.php', {
params: {
q: query,
type,
limit,
offset,
},
});
const rawResults = res.data?.results || [];
const results = rawResults.map((item) => {
const id = extractSpotifyId(item.url);
return {
type: item.type,
name: item.name,
subtitle: item.subtitle,
cover: item.cover,
url: item.url,
id,
};
});
return {
success: true,
query,
type,
total: res.data?.total || results.length,
results,
};
}
/**
* Resolve Spotify URL (artist, album, playlist, track)
* @param {string} urlOrId
* @param {'artist'|'track'|'album'|'playlist'} defaultType
*/
async function resolve(urlOrId, defaultType = 'artist') {
if (!urlOrId) throw new Error('URL atau ID Spotify wajib diisi.');
const fullUrl = normalizeSpotifyUrl(urlOrId, defaultType);
const res = await client.post(
'/resolve.php',
{ url: fullUrl },
{
headers: {
'Content-Type': 'application/json',
},
}
);
const data = res.data;
if (!data || data.detail) {
throw new Error(data?.detail || 'Gagal meresolve data Spotify.');
}
const tracks = (data.tracks || []).map((t) => {
const trackId = extractSpotifyId(t.spotify_url);
return {
title: t.title,
artist: t.artist,
album: t.album,
cover: t.cover,
thumbnail: t.thumb,
durationMs: t.duration_ms,
duration: formatDuration(t.duration_ms),
explicit: Boolean(t.explicit),
popularity: t.popularity ?? null,
spotifyUrl: t.spotify_url,
trackId,
};
});
return {
success: true,
kind: data.kind,
name: data.name,
description: data.description,
cover: data.cover,
owner: data.owner,
followers: data.followers,
totalTracks: data.total || tracks.length,
tracks,
};
}
/**
* Get Spotify audio preview MP3 link
* @param {string} trackIdOrUrl
*/
async function getPreview(trackIdOrUrl) {
if (!trackIdOrUrl) throw new Error('Track ID atau URL Spotify wajib diisi.');
const trackId = extractSpotifyId(trackIdOrUrl);
const res = await axios.get(`${API_PREVIEW_URL}/api/preview/${trackId}`, {
headers: {
'User-Agent': USER_AGENT,
Origin: BASE_URL,
Referer: `${BASE_URL}/`,
},
timeout: 10000,
});
return {
success: true,
trackId,
previewUrl: res.data?.url || null,
};
}
module.exports = {
search,
resolve,
getPreview,
extractSpotifyId,
normalizeSpotifyUrl,
};
// CLI Runner
if (require.main === module) {
(async () => {
try {
const args = process.argv.slice(2);
const firstArg = args[0] || 'Coldplay';
const secondArg = args[1];
let res;
if (firstArg.toLowerCase() === 'search') {
const query = secondArg || args.slice(1).join(' ') || 'Coldplay';
const type = args[2] || 'artist';
res = await search(query, type);
} else if (firstArg.toLowerCase() === 'preview') {
res = await getPreview(secondArg || '3AJwUDP919kvQ9QcozQPxg');
} else if (firstArg.toLowerCase() === 'artist') {
res = await resolve(secondArg || 'https://open.spotify.com/artist/4gzpq5DPGxSnKTe4SA8HAU', 'artist');
} else if (firstArg.startsWith('http://') || firstArg.startsWith('https://') || /^[a-zA-Z0-9]{22}$/.test(firstArg)) {
res = await resolve(firstArg, 'artist');
} else {
// Search artist by name, then automatically resolve the top matching artist
const searchRes = await search(args.join(' '), 'artist', 5);
if (searchRes.results.length > 0) {
const topArtist = searchRes.results[0];
const artistDetail = await resolve(topArtist.url, 'artist');
res = {
...artistDetail,
matchedArtist: topArtist,
alternativeArtists: searchRes.results.slice(1),
};
} else {
res = {
success: false,
message: `Artis "${args.join(' ')}" tidak ditemukan.`,
};
}
}
console.log(JSON.stringify(res, null, 2));
} catch (err) {
console.error(
JSON.stringify(
{
success: false,
error: err.message || 'Terjadi kesalahan pada scraper Spotify.',
},
null,
2
)
);
process.exit(1);
}
})();
}