Created
January 1, 2026 09:09
-
-
Save ONLym22/9ae2587fd8b9702e5c6b0f9769938830 to your computer and use it in GitHub Desktop.
Uploaded via ONLym Bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // π Source: JavaScript | |
| case "scrape": { | |
| if (!isPremium && !isOwner) return onlyPrem(); | |
| if (!text) return xreply(`Format salah!\n\nContoh: ${prefix + command} https://example.com | ambil semua link gambar`); | |
| xreact("π"); | |
| try { | |
| let [url, ...promptArray] = text.split("|"); | |
| let targetUrl = url.trim(); | |
| let userPrompt = promptArray.length > 0 ? promptArray.join("|").trim() : "ambil semua data penting dari halaman ini"; | |
| const apiUrl = `https://onlym.my.id/ai/web-parser?url=${encodeURIComponent(targetUrl)}&prompt=${encodeURIComponent(userPrompt)}&apikey=onlymid`; | |
| const response = await fetch(apiUrl); | |
| const textRes = await response.text(); | |
| let json; | |
| try { | |
| json = JSON.parse(textRes); | |
| } catch { | |
| return xreply("β Gagal parsing JSON. Respons server tidak sesuai."); | |
| } | |
| if (!json.status || !json.result) return xreply("β API gagal memproses permintaan. Pastikan URL valid dan dapat diakses."); | |
| const { target, instruction, generated_code } = json.result; | |
| let caption = `*β¨ WEB PARSER RESULT β¨*\n\n`; | |
| caption += `π *Target:* ${target}\n`; | |
| caption += `π *Prompt:* ${instruction}\n\n`; | |
| caption += `π» *Preview Code:*\n\`\`\`javascript\n${generated_code.slice(0, 300)}...\n\`\`\`\n\n`; | |
| caption += `_Full code dikirim melalui file di bawah._`; | |
| await vellia.sendMessage(m.chat, { | |
| text: caption, | |
| contextInfo: { | |
| forwardingScore: 999, | |
| isForwarded: true, | |
| forwardedNewsletterMessageInfo: { | |
| newsletterName: wm, | |
| newsletterJid: chjid + "@newsletter", | |
| }, | |
| }, | |
| }, { quoted: qkontak }); | |
| await vellia.sendMessage(m.chat, { | |
| document: Buffer.from(generated_code), | |
| fileName: `scraper_${Date.now()}.js`, | |
| mimetype: "application/javascript", | |
| contextInfo: { | |
| forwardingScore: 999, | |
| isForwarded: true, | |
| forwardedNewsletterMessageInfo: { | |
| newsletterName: wm, | |
| newsletterJid: chjid + "@newsletter", | |
| }, | |
| }, | |
| }, { quoted: qkontak }); | |
| } catch (e) { | |
| console.error(e); | |
| xreply(`β Terjadi kesalahan sistem: ${e.message}`); | |
| } | |
| } | |
| break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment