/** * NanzMusify - Modern YouTube Music Player, Downloader & Synced Lyrics Scraper * Source Target: https://nanzmusify-updated.netlify.app/ * Author: Vamz Spectre (VamxAPI) * * Fitur Unggulan: * 1. Search Music, Albums, Artists, & Playlists * 2. Play Music (Direct Stream MP3 256kbps + Synced Lyrics + Translations) * 3. Download MP3 (Direct Download 256kbps & 48kbps via Vidssave AES Engine) * 4. Real-time Synced Lyrics + Indonesian Line Translations * 5. Home / Trending Charts & Recommendations * 6. Search Auto-suggestions * 7. Album & Artist Discography * * CARA PAKAI VIA CLI: * curl -sL "https://code.vamxapi.my.id/snippet/raw/nanzmusify-updated" -o nanzmusify-updated.js * node nanzmusify-updated.js play "Rewrite The Stars Zendaya" * node nanzmusify-updated.js download "RbimXGH5zkE" * node nanzmusify-updated.js search "Rewrite The Stars" songs * node nanzmusify-updated.js lyrics "RbimXGH5zkE" * node nanzmusify-updated.js home */ const crypto = require('crypto'); const BASE_URL = 'https://nanzmusify-updated.netlify.app'; const VIDSSAVE_PARSE_URL = 'https://api.vidssave.com/api/contentsite_api/media/parse'; let cachedAuth = '4c9b7d21'; let lastAuthScrape = 0; /** * Scrape dynamic auth token from vidssave if expired */ async function getVidssaveAuth() { if (Date.now() - lastAuthScrape < 15 * 60 * 1000 && cachedAuth) { return cachedAuth; } try { const res = await fetch('https://vidssave.com/', { headers: { 'User-Agent': 'Mozilla/5.0' } }); const html = await res.text(); const chunks = html.match(/src="([^"]*chunk[^"]*\.js)"/g) || []; for (const c of chunks) { const src = c.replace(/^src="/, '').replace(/"$/, ''); const chunkUrl = src.startsWith('http') ? src : `https://vidssave.com${src}`; const chunkRes = await fetch(chunkUrl); const chunkText = await chunkRes.text(); const match = chunkText.match(/auth:"([a-zA-Z0-9_-]{6,32})"/); if (match) { cachedAuth = match[1]; lastAuthScrape = Date.now(); return cachedAuth; } } } catch (_) {} return cachedAuth || '4c9b7d21'; } /** * Decrypt Vidssave AES payload */ function decryptVidssavePayload(ciphertext, authKey) { const keys = [ '4c9b7d2e'.repeat(3) + (authKey || cachedAuth || '4c9b7d21'), '4c9b7d2e'.repeat(3) + '4c9b7d21', '4c9b7d2e'.repeat(3) + '4c9b7d2e', 'rz18efAXUbdiaO7k' ]; for (const k of keys) { try { const keyBuf = Buffer.from(k, 'utf8'); const ivBuf = Buffer.from(k.slice(0, 16), 'utf8'); const decipher = crypto.createDecipheriv( k.length === 32 ? 'aes-256-cbc' : 'aes-128-cbc', keyBuf, ivBuf ); decipher.setAutoPadding(false); let decrypted = decipher.update(ciphertext, 'base64', 'utf8'); decrypted += decipher.final('utf8'); decrypted = decrypted.replace(/\0+$/, ''); const parsed = JSON.parse(decrypted); if (parsed && (parsed.resources || parsed.title)) { return parsed; } } catch (_) {} } return null; } /** * Extract audio resources from YouTube Video ID via Vidssave AES Engine */ async function extractAudio(videoId, isRetry = false) { const auth = await getVidssaveAuth(); const link = `https://www.youtube.com/watch?v=${videoId}`; const params = new URLSearchParams({ hostname: 'vidssave.com', auth: auth, domain: 'api-ak.vidssave.com', link: link }); const res = await fetch(VIDSSAVE_PARSE_URL, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'User-Agent': 'Mozilla/5.0' }, body: params.toString() }); if (!res.ok) { throw new Error(`Vidssave HTTP error: ${res.status}`); } const json = await res.json(); if (!json || json.status !== 1 || !json.data) { if (!isRetry) { lastAuthScrape = 0; await getVidssaveAuth(); return extractAudio(videoId, true); } throw new Error(`Vidssave parse rejected: ${JSON.stringify(json).slice(0, 150)}`); } const decrypted = decryptVidssavePayload(json.data, auth); if (!decrypted) { throw new Error('Failed to decrypt audio payload'); } const resources = decrypted.resources || []; const audios = resources.filter(r => r.type === 'audio' && r.download_url); const preferredQualities = ['256KBPS', '128KBPS', 'LOW', '48KBPS']; audios.sort((a, b) => { let ia = preferredQualities.indexOf(a.quality); let ib = preferredQualities.indexOf(b.quality); if (ia === -1) ia = 99; if (ib === -1) ib = 99; return ia - ib; }); return { title: decrypted.title, thumbnail: decrypted.thumbnail || `https://i.ytimg.com/vi_webp/${videoId}/sddefault.webp`, duration: decrypted.duration, streamUrl: audios.length > 0 ? audios[0].download_url : null, quality: audios.length > 0 ? audios[0].quality : null, downloadLinks: audios.map(a => ({ quality: a.quality, format: a.format, size: a.size, downloadUrl: a.download_url })) }; } const nanzmusify = { /** * Search songs, albums, artists, or playlists */ async search(query, type = 'songs') { if (!query) throw new Error('Query parameter is required'); const res = await fetch(`${BASE_URL}/api/search?query=${encodeURIComponent(query)}&type=${type}`); return await res.json(); }, /** * Query search auto-suggestions */ async suggest(query) { if (!query) throw new Error('Query parameter is required'); const res = await fetch(`${BASE_URL}/api/suggest?q=${encodeURIComponent(query)}`); return await res.json(); }, /** * Get home recommendations, trending, quick picks, and charts */ async home() { const res = await fetch(`${BASE_URL}/api/home`); return await res.json(); }, /** * Get synced timestamped lyrics with Indonesian translations */ async lyrics(id, title = '', artist = '') { if (!id) throw new Error('Video ID is required'); const params = new URLSearchParams({ id }); if (title) params.append('title', title); if (artist) params.append('artist', artist); const res = await fetch(`${BASE_URL}/api/lyrics?${params.toString()}`); return await res.json(); }, /** * Get album tracks and details */ async album(albumId) { if (!albumId) throw new Error('Album ID is required'); const res = await fetch(`${BASE_URL}/api/album?id=${encodeURIComponent(albumId)}`); return await res.json(); }, /** * Get artist overview, top songs, and albums */ async artist(artistId) { if (!artistId) throw new Error('Artist ID is required'); const res = await fetch(`${BASE_URL}/api/artist?id=${encodeURIComponent(artistId)}`); return await res.json(); }, /** * Download MP3: resolves direct 256kbps/48kbps download URLs for a song */ async download(queryOrId) { let videoId = queryOrId; let trackInfo = null; if (!/^[a-zA-Z0-9_-]{11}$/.test(queryOrId)) { const searchRes = await this.search(queryOrId, 'songs'); const first = searchRes?.result?.songs?.[0]; if (!first || !first.videoId) { throw new Error(`No songs found matching: "${queryOrId}"`); } videoId = first.videoId; trackInfo = first; } const audioData = await extractAudio(videoId); return { status: true, creator: 'Vamz Spectre', result: { videoId, title: trackInfo?.title || audioData.title, artist: trackInfo?.artist || null, album: trackInfo?.album || null, duration: audioData.duration, thumbnail: trackInfo?.thumbnail || audioData.thumbnail, streamUrl: audioData.streamUrl, quality: audioData.quality, downloads: audioData.downloadLinks } }; }, /** * Play song: fetches direct streaming URL, song info, and synced lyrics in one call */ async play(queryOrId) { let videoId = queryOrId; let trackInfo = null; if (!/^[a-zA-Z0-9_-]{11}$/.test(queryOrId)) { const searchRes = await this.search(queryOrId, 'songs'); const first = searchRes?.result?.songs?.[0]; if (!first || !first.videoId) { throw new Error(`No songs found matching: "${queryOrId}"`); } videoId = first.videoId; trackInfo = first; } const [audioData, lyricsData] = await Promise.all([ extractAudio(videoId), this.lyrics(videoId, trackInfo?.title || '', trackInfo?.artist || '').catch(() => null) ]); return { status: true, creator: 'Vamz Spectre', result: { videoId, title: trackInfo?.title || audioData.title, artist: trackInfo?.artist || null, album: trackInfo?.album || null, duration: audioData.duration, thumbnail: trackInfo?.thumbnail || audioData.thumbnail, streamUrl: audioData.streamUrl, quality: audioData.quality, downloads: audioData.downloadLinks, lyrics: lyricsData?.result?.lyrics || null } }; } }; module.exports = nanzmusify; // CLI Runner if (require.main === module) { (async () => { const action = process.argv[2] || 'play'; const param = process.argv[3] || 'Rewrite The Stars Zendaya'; try { let result; switch (action.toLowerCase()) { case 'search': result = await nanzmusify.search(param, process.argv[4] || 'songs'); break; case 'suggest': result = await nanzmusify.suggest(param); break; case 'home': result = await nanzmusify.home(); break; case 'lyrics': result = await nanzmusify.lyrics(param, process.argv[4] || '', process.argv[5] || ''); break; case 'album': result = await nanzmusify.album(param); break; case 'artist': result = await nanzmusify.artist(param); break; case 'download': result = await nanzmusify.download(param); break; case 'play': default: result = await nanzmusify.play(param); break; } console.log(JSON.stringify(result, null, 2)); } catch (err) { console.error(JSON.stringify({ status: false, error: err.message }, null, 2)); process.exit(1); } })(); }