/** * Soundclouds Downloader * Base : https://downcloudme.com * Author : Gienetic * Request : knz */ import fs from 'fs'; const sandi = "b4f28fefc8"; const markas = "https://downcloudme.com/download-track"; const pantau = "https://www.scloudme.com/dl/status/"; const meta = "https://soundcloud.com/oembed"; const agen = "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Mobile Safari/537.36 AlohaBrowser/8.8.0 (Gienetic)"; const argumen = process.argv.slice(2); const target = argumen.find(a => a.includes("soundcloud.com/")); const jeda = (ms) => new Promise(r => setTimeout(r, ms)); const bersih = (teks) => teks.replace(/[<>:"/\\|?*]+/g, "_").replace(/\s+/g, " ").trim(); const lacak = (teks) => { const m = teks.match(/const jobId\s*=\s*"([^"]+)"/); return m ? m[1] : null; }; const namai = (teks) => { const m = teks.match(/const fileName\s*=\s*"([^"]+)"/); return m ? m[1] : "unduhan.mp3"; }; const intai = async (url) => { try { const balasan = await fetch(`${meta}?url=${encodeURIComponent(url)}&format=json`); if (!balasan.ok) return null; const data = await balasan.json(); return { judul: data.title || null, artis: data.author_name || null, sampul: data.thumbnail_url || null }; } catch { return null; } }; const tembak = async (url) => { const muatan = new URLSearchParams(); muatan.append("url", url); muatan.append("downloader_verify", sandi); const balasan = await fetch(markas, { method: "POST", headers: { "content-type": "application/x-www-form-urlencoded", "origin": "https://downcloudme.com", "referer": "https://downcloudme.com/enTc/", "user-agent": agen }, body: muatan.toString() }); const teks = await balasan.text(); const id = lacak(teks); const nama = namai(teks); if (!id) throw new Error("Gagal"); return { id, nama }; }; const tunggu = async (id) => { for (let i = 0; i < 120; i++) { await jeda(1000); const balasan = await fetch(pantau + id, { headers: { "origin": "https://downcloudme.com", "user-agent": agen, "x-requested-with": "AlohaBrowser" } }); if (balasan.status !== 200) continue; const data = await balasan.json(); if (data.api2?.rapid_url) return data.api2.rapid_url; if (data.api2?.error) { if (data.api1?.download_link) return data.api1.download_link; throw new Error(data.api2.error); } } throw new Error("Batas"); }; const sedot = async (url, tujuan) => { const balasan = await fetch(url); if (!balasan.ok) throw new Error("Gagal"); const kepingan = []; const pembaca = balasan.body.getReader(); while (true) { const { done, value } = await pembaca.read(); if (done) break; kepingan.push(value); } const utuh = Buffer.concat(kepingan); fs.writeFileSync(tujuan, utuh); return utuh.length; }; const sikat = async (url) => { if (!url) { console.error(JSON.stringify({ status: false, galat: "Nihil" }, null, 2)); return; } try { const hasil = { status: false, target: url, info: null, audio: null, ukuran: 0 }; const info = await intai(url); if (info) hasil.info = info; const { id, nama } = await tembak(url); const tautan = await tunggu(id); let berkas = bersih(nama); if (info && info.artis && info.judul) { let tajuk = info.judul; if (tajuk.endsWith(` by ${info.artis}`)) { tajuk = tajuk.slice(0, -(4 + info.artis.length)); } berkas = bersih(`${info.artis} - ${tajuk}.mp3`); } const ukuran = await sedot(tautan, berkas); hasil.audio = berkas; hasil.ukuran = ukuran; if (info && info.sampul) { const murni = info.sampul.replace("-t500x500", "-original"); const wajah = berkas.replace(/\.mp3$/i, ".jpg"); try { const u = await sedot(murni, wajah); hasil.sampul = { file: wajah, ukuran: u }; } catch { try { const u = await sedot(info.sampul, wajah); hasil.sampul = { file: wajah, ukuran: u }; } catch {} } } hasil.status = true; console.log(JSON.stringify(hasil, null, 2)); } catch (e) { console.error(JSON.stringify({ status: false, galat: e.message }, null, 2)); } }; export { sikat }; if (argumen.length > 0) { sikat(target); } //node namafile.js "https://soundcloud.com/themarias/no-one-noticed"