/** * AI DeepSearch * Author : Gienetic * Base : https://play.google.com/store/apps/details?id=in.dealempire.deepsearch * Jenis Apk : Flutter * Note : Kuki dah bikin ambil otomatis, ada fitur model lain, tapi untuk skrepan gratisan ini sudah cukup lah wkwkw, */ const axios = require('axios'); const InfoTarget = { host: "getliner.com", user_agent: "Gienetic_sniff/4.11.0" }; const buatHeader = (kue = null) => { const headers = { "user-agent": InfoTarget.user_agent, "x-liner-platform-type": "app", "accept": "application/json, text/plain, */*", "accept-encoding": "gzip", "content-type": "application/json; charset=utf-8", "host": InfoTarget.host, "connection": "Keep-Alive" }; if (kue) headers["cookie"] = kue; return headers; }; async function cetakIdentitas() { try { const resp = await axios.post(`https://${InfoTarget.host}/auth/guest`, {}, { headers: buatHeader() }); const rawCookie = resp.headers['set-cookie']; const kueMatang = rawCookie ? rawCookie.map(c => c.split(';')[0]).join('; ') : ""; return { sukses: true, uid: resp.data.id, kue: kueMatang }; } catch (e) { return { sukses: false }; } } async function bangunBrankas(identitas) { try { const material = { "name": "General", "color": "#50555C", "icon": "folder" }; const resp = await axios.post(`https://${InfoTarget.host}/v1/space`, material, { headers: buatHeader(identitas.kue) }); return resp.data.id; } catch (e) { return null; } } async function cariRuangBrankas(identitas) { try { const resp = await axios.get(`https://${InfoTarget.host}/v1/spaces?page=1&limit=5`, { headers: buatHeader(identitas.kue) }); if (resp.data.items && resp.data.items.length > 0) { return resp.data.items[0].id; } else { return await bangunBrankas(identitas); } } catch (e) { return await bangunBrankas(identitas); } } async function retasPintu(identitas, vaultId, misi) { const payload = { "userId": identitas.uid, "metadata": null, "messagePieces": [{ "type": "text", "content": { "text": misi } }], "attachments": [], "mode": "general", "deviceType": "android" }; try { const resp = await axios.post(`https://${InfoTarget.host}/v1/space/${vaultId}/thread`, payload, { headers: buatHeader(identitas.kue) }); return { id: resp.data.id, msgId: resp.data.messageId }; } catch (e) { return null; } } async function sikatData(identitas, vaultId, akses, misi) { const payload = { "spaceId": vaultId, "threadId": akses.id, "userMessageId": akses.msgId, "userId": identitas.uid, "query": misi, "agentId": "researcher", "platform": "app", "regenerate": false, "modelType": "liner-pro", "showReferenceChunks": true, "mode": "general" }; try { const stream = await axios.post(`https://${InfoTarget.host}/platform/copilot/v3/answer`, payload, { headers: buatHeader(identitas.kue), responseType: 'stream' }); return new Promise((resolve) => { let hasil = ""; let buffer = ""; stream.data.on('data', (chunk) => { buffer += chunk.toString(); const lines = buffer.split('\n'); buffer = lines.pop(); for (const line of lines) { if (line.trim()) { try { const json = JSON.parse(line); if (json.answer) hasil += json.answer; } catch (e) {} } } }); stream.data.on('end', () => { resolve({ author: "gienetic", status: "success", code: 200, target: misi, data: hasil }); }); stream.data.on('error', (err) => { resolve({ status: "failed", code: 500, error: err.message }); }); }); } catch (e) { return { status: "error", code: 503, error: e.message }; } } // RUN (async () => { const misi = "Siapakah Ayogi Akbar Afrenggo Itu ?"; const agen = await cetakIdentitas(); if (agen.sukses) { const vaultId = await cariRuangBrankas(agen); if (vaultId) { const akses = await retasPintu(agen, vaultId, misi); if (akses) { const hasil = await sikatData(agen, vaultId, akses, misi); console.log(JSON.stringify(hasil, null, 4)); } else { console.log(JSON.stringify({ status: "failed", msg: "Thread creation failed" }, null, 4)); } } else { console.log(JSON.stringify({ status: "failed", msg: "Failed to create/find Vault" }, null, 4)); } } else { console.log(JSON.stringify({ status: "failed", msg: "Guest auth failed" }, null, 4)); } })();