S
@saurus2 files
Published 45 minutes ago
javascript

Lyric Potato

Lyrics potato, mencari lyrics nya dari mp3

Auto-Detected Dependencies
axios
$ npm install axios
Raw
lyricpotato.jsjavascriptยท 278 lines ยท 9.9 KB
/** * Lyric Potato AI - Timed Lyrics Generator & Audio Uploader * Creator: SAURUS * Base: https://lyricpotato.com/ * Saluran: https://whatsapp.com/channel/0029VbDhTC6KLaHjHKXl552C * Note: pliss guys jangan di klaim 100% buatan lu, lu boleh kok modifikasi trs share lagi tapi tolong jangan ilangin header creator sama ch-nya */ const fs = require('fs');const path = require('path');const crypto = require('crypto');const axios = require('axios'); const _p = ["a1++I9gSGLprXrYjgxIWvz9Y7nODQU29agu5dN4XS+lv", "X7knj0FPvDwJ6irfTR28aV65do1BSuBjDu5zghcY7g=="];const _k = [0x5a, 0x3c, 0x8f, 0x12, 0xbb, 0x74, 0x2e, 0xd9]; function _ld() {    const raw = Buffer.from(_p.join(''), 'base64');    const out = Buffer.alloc(raw.length);    for (let i = 0; i < raw.length; i++) out[i] = raw[i] ^ _k[i % _k.length];    return out.toString('utf8');} function _hd() {    try {        const src = fs.readFileSync(__filename, 'utf8');        const m = src.match(/^\s*\/\*\*[\s\S]*?\*\//);        if (!m) return '';        const keys = ['Creator:', 'Saluran:', 'Note:'];        const lines = m[0].split('\n').map(l => l.replace(/^\s*\*?\s*/, '').replace(/\s+/g, ''));        const pick = keys.map(k => lines.find(l => l.startsWith(k)));        if (pick.some(x => !x)) return '';        return crypto.createHash('sha256').update(pick.join('')).digest('hex');    } catch (_) {        return '';    }} function _ck() {    const h = _hd();    if (!h || h !== _ld()) throw new Error('ctx invalid: header creator & saluran tidak boleh dihapus atau dimodifikasi!');} const BASE_URL = 'https://distrokid.com';const S3_URL = 'https://potatoai.s3.amazonaws.com/';const CREATOR = 'SAURUS';const SALURAN = 'https://whatsapp.com/channel/0029VbDhTC6KLaHjHKXl552C'; const DEFAULT_CONFIG = {    bucketName: 'potatoai',    accessKeyId: 'AKIARYIZLBF43Y4H6CWB',    policy: 'eyJleHBpcmF0aW9uIjogIjIwMjYtMTItMDRUMDA6MDA6MDBaIiwKICAiY29uZGl0aW9ucyI6IAogIFsgCiAgICB7ImJ1Y2tldCI6ICJwb3RhdG9haSJ9LCAKICAgIFsic3RhcnRzLXdpdGgiLCAiJGtleSIsICIiXSwKICAgIFsic3RhcnRzLXdpdGgiLCAiJENvbnRlbnQtVHlwZSIsICJhdWRpby8iXSwKICAgIFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLCAwLCAyNjIxNDQwMDBdCiAgXQp9',    signature: 'OkdSePj8flD/PqRZ2LaL/YFFWCg='}; function getMimeType(filePath) {    const ext = path.extname(filePath).toLowerCase();    if (ext === '.mp3') return 'audio/mpeg';    if (ext === '.m4a') return 'audio/x-m4a';    if (ext === '.wav') return 'audio/wav';    if (ext === '.flac') return 'audio/flac';    return 'audio/mpeg';} async function getCredentials() {    _ck();    try {        const res = await axios.get(`${BASE_URL}/api/potatoai/s3stuff/`, {            headers: {                'Referer': 'https://lyricpotato.com/',                'Origin': 'https://lyricpotato.com',                'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/157.0.0.0 Safari/537.36'            },            timeout: 7000        });        if (res.data && res.data.accessKeyId) {            return {                bucketName: res.data.BucketName || DEFAULT_CONFIG.bucketName,                accessKeyId: res.data.accessKeyId,                policy: res.data.PolicyBase64,                signature: res.data.signature            };        }    } catch (_) {}    return DEFAULT_CONFIG;} async function uploadAudio(audioPath) {    _ck();    const start = Date.now();    try {        const resolvedPath = path.resolve(audioPath);        if (!fs.existsSync(resolvedPath)) {            throw new Error(`File audio tidak ditemukan di: ${audioPath}`);        }         const stat = fs.statSync(resolvedPath);        if (stat.size > 200 * 1024 * 1024) {            throw new Error('Ukuran file melebihi batas maksimum 200MB');        }         const ext = path.extname(resolvedPath).replace('.', '') || 'mp3';        const fileUUID = crypto.randomUUID();        const s3Key = `potatoai.${fileUUID}.${ext}`;        const contentType = getMimeType(resolvedPath);        const creds = await getCredentials();         const fileBuffer = fs.readFileSync(resolvedPath);        const boundary = '----WebKitFormBoundary' + crypto.randomBytes(16).toString('hex');                const parts = [            `--${boundary}\r\nContent-Disposition: form-data; name="key"\r\n\r\n${s3Key}\r\n`,            `--${boundary}\r\nContent-Disposition: form-data; name="Content-Type"\r\n\r\n${contentType}\r\n`,            `--${boundary}\r\nContent-Disposition: form-data; name="AWSAccessKeyId"\r\n\r\n${creds.accessKeyId}\r\n`,            `--${boundary}\r\nContent-Disposition: form-data; name="Policy"\r\n\r\n${creds.policy}\r\n`,            `--${boundary}\r\nContent-Disposition: form-data; name="Signature"\r\n\r\n${creds.signature}\r\n`,            `--${boundary}\r\nContent-Disposition: form-data; name="file"; filename="${path.basename(resolvedPath)}"\r\nContent-Type: ${contentType}\r\n\r\n`        ];         const payload = Buffer.concat([            Buffer.from(parts.join(''), 'utf8'),            fileBuffer,            Buffer.from(`\r\n--${boundary}--\r\n`, 'utf8')        ]);         const s3Res = await axios.post(S3_URL, payload, {            headers: {                'Content-Type': `multipart/form-data; boundary=${boundary}`,                'Origin': 'https://lyricpotato.com',                'Referer': 'https://lyricpotato.com/'            },            maxContentLength: Infinity,            maxBodyLength: Infinity,            validateStatus: s => s >= 200 && s < 400        });         const clientCode = crypto.randomUUID();         return {            Creator: CREATOR,            Saluran: SALURAN,            time: `${Date.now() - start}ms`,            status: true,            message: 'Audio berhasil diupload langsung ke AWS S3',            data: {                filename: path.basename(resolvedPath),                fileSize: stat.size,                s3Key: s3Key,                s3Status: s3Res.status,                clientCode: clientCode,                notifyEndpoint: `${BASE_URL}/api/potatoai/uploadDone/`,                checkTimedUrl: `${BASE_URL}/potatoai/timed/?id=PENDING&code=${clientCode}`            }        };    } catch (e) {        return {            Creator: CREATOR,            Saluran: SALURAN,            time: `${Date.now() - start}ms`,            status: false,            error: e.response?.data?.message || e.message        };    }} async function notifyDone(s3Key, clientCode) {    _ck();    const start = Date.now();    try {        if (!s3Key) throw new Error('S3 Key filename is required');        const code = clientCode || crypto.randomUUID();        const payload = new URLSearchParams({ filename: s3Key, code }).toString();         const res = await axios.post(`${BASE_URL}/api/potatoai/uploadDone/`, payload, {            headers: {                'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',                'Accept': 'application/json, text/javascript, */*; q=0.01',                'Origin': 'https://lyricpotato.com',                'Referer': 'https://lyricpotato.com/',                'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/157.0.0.0 Safari/537.36'            },            validateStatus: () => true        });         const jobId = res.data && res.data.id ? res.data.id : null;        return {            Creator: CREATOR,            Saluran: SALURAN,            time: `${Date.now() - start}ms`,            status: res.status === 200,            httpStatus: res.status,            s3Key,            code,            jobId: jobId,            resultUrl: `${BASE_URL}/potatoai/timed/?id=${jobId || 'PENDING'}&code=${code}`,            rawResponse: typeof res.data === 'object' ? res.data : 'CLOUDFLARE_PROTECTED_OR_HTML'        };    } catch (e) {        return {            Creator: CREATOR,            Saluran: SALURAN,            time: `${Date.now() - start}ms`,            status: false,            error: e.message        };    }} async function processAudio(audioPath) {    _ck();    const start = Date.now();    try {        const upload = await uploadAudio(audioPath);        if (!upload.status) return upload;         const notify = await notifyDone(upload.data.s3Key, upload.data.clientCode);         return {            Creator: CREATOR,            Saluran: SALURAN,            time: `${Date.now() - start}ms`,            status: true,            audioFile: upload.data.filename,            fileSize: upload.data.fileSize,            s3Key: upload.data.s3Key,            clientCode: upload.data.clientCode,            jobId: notify.jobId,            resultUrl: notify.resultUrl,            s3UploadStatus: upload.data.s3Status,            notifyStatus: notify.httpStatus        };    } catch (e) {        return {            Creator: CREATOR,            Saluran: SALURAN,            time: `${Date.now() - start}ms`,            status: false,            error: e.message        };    }} async function main() {    const args = process.argv.slice(2);    const targetFile = args[0] || './audio.mp3';     if (targetFile === '--help' || targetFile === '-h') {        console.log('Usage:');        console.log(' node lyricpotato.js ./audio.mp3');        console.log(' node lyricpotato.js upload ./audio.mp3');        console.log(' node lyricpotato.js notify <s3Key> <clientCode>');        return;    }     if (targetFile === 'upload') {        const file = args[1] || './audio.mp3';        const res = await uploadAudio(file);        console.log(JSON.stringify(res, null, 2));    } else if (targetFile === 'notify') {        const s3Key = args[1];        const code = args[2];        const res = await notifyDone(s3Key, code);        console.log(JSON.stringify(res, null, 2));    } else {        const res = await processAudio(targetFile);        console.log(JSON.stringify(res, null, 2));    }} if (require.main === module) {    main();} module.exports = {    uploadAudio,    notifyDone,    processAudio};
README.md โ€” Dokumentasi & Panduan

Lyric Potato AI Scraper & Uploader

Creator: SAURUS

Saluran WhatsApp: Join Channel

Note: Pliss guys jangan diklaim 100% buatan lu! Lu boleh kok modifikasi terus share lagi, tapi tolong jangan hilangin header creator sama channel-nya ya.

โšก Fitur & Arsitektur

Integrity Check: Menggunakan SHA-256 dan proteksi XOR Base64 header check agar credit creator dan link saluran WhatsApp tetap utuh saat di-share ulang.

Direct AWS S3 Upload: Upload audio langsung ke Amazon S3 (potatoai.s3.amazonaws.com) menggunakan policy signature bawaan tanpa terhambat batas proxy.

DistroKid AI Trigger: Notifikasi otomatis ke backend AI Lyric Potato (/api/potatoai/uploadDone/).

Respon JSON Standard: Format output rapi dengan metadata file, status S3, dan URL tracking timed lyrics.

๐Ÿ“ฆ Instalasi

Pastikan Node.js sudah terpasang, lalu install dependensi:

bash

npm install axios

๐Ÿš€ Penggunaan CLI

  1. Proses Langsung File Audio (Default ./audio.mp3)

bash

node lyricpotato.js ./audio.mp3

  1. Upload Audio Saja ke AWS S3

bash

node lyricpotato.js upload ./audio.mp3

  1. Notifikasi Ulang Manual via S3 Key

bash

node lyricpotato.js notify <s3Key> <clientCode>

๐Ÿ“„ Contoh Output JSON

json

{

"Creator": "SAURUS",

"Saluran": "https://whatsapp.com/channel/0029VbDhTC6KLaHjHKXl552C",

"time": "57269ms",

"status": true,

"audioFile": "audio.mp3",

"fileSize": 3332397,

"s3Key": "potatoai.350ec14e-61c8-4167-bd6f-6871c3d3ee15.mp3",

"clientCode": "5e6cdd20-5943-434f-a97a-48dcb18ddb87",

"jobId": null,

"resultUrl": "https://distrokid.com/potatoai/timed/?id=PENDING&code=5e6cdd20-5943-434f-a97a-48dcb18ddb87",

"s3UploadStatus": 204,

"notifyStatus": 403

}

๐Ÿ’ป Penggunaan sebagai Module (Require)

javascript

const { processAudio, uploadAudio } = require('./lyricpotato.js');

async function run() {

const res = await processAudio('./audio.mp3');

console.log(res);

}

run();