/** * Shopee Video Downloader * base: https://shopeenowatermark.com * Creator: ShanMolvyr * Jangan Hapus Kreator hargai rakyat kecil * Note: cek https://snippet.vyr.my.id/shanmolvyr/shopeedl/README.md * Sumber: https://whatsapp.com/channel/0029VbB4Kw8EFeXfeExaXc3Q */ const BASE_URL = 'https://shopeenowatermark.com'; async function extract(url) { const form = new FormData(); form.append('url', url); const res = await fetch(`${BASE_URL}/api/extract`, { method: 'POST', body: form, }); if (!res.ok) throw new Error(`HTTP ${res.status}`); const data = await res.json(); if (!data.success) throw new Error(data.error || 'Extraction failed'); return data; } function bestStream(streams) { const order = ['V1080P', 'V720P', 'V540P', 'V360P', 'V1080P_H265', 'V720P_H265', 'V540P_H265', 'V360P_H265']; for (const q of order) { const s = streams.find(s => s.quality === q); if (s) return s; } return streams[0]; } export { extract, bestStream }; if (process.argv[1] === new URL(import.meta.url).pathname) { const url = process.argv[2]; if (!url) { console.error('Usage: node shopeedl.js '); process.exit(1); } try { const data = await extract(url); const best = bestStream(data.streams_array); console.log(JSON.stringify({ credit: 'by ShanMolvyr (snippet.vyr.my.id)', username: data.username, preview: data.preview, best: { quality: best.quality, codec: best.codec, url: best.stream_url }, streams: data.streams_array.map(s => ({ quality: s.quality, codec: s.codec, url: s.stream_url })), }, null, 2)); } catch (e) { console.error(e.message); process.exit(1); } }