Ayogiakbar

TOOLS AI

Aug 21st, 2025 (edited)
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Tools Ai - Web
  3.  * Author  : gienetic
  4.  * Base  : https://www.junia.ai
  5.  */
  6.  
  7. const axios = require("axios");
  8.  
  9. const Base_Api = "https://www.junia.ai/api/free-tools/generate";
  10.  
  11. async function juniaRequest(payload) {
  12.   if (!payload || !payload.op)
  13.     throw new Error("Payload harus ada dan minimal berisi field op");
  14.  
  15.   try {
  16.     const res = await axios.post(Base_Api, payload, {
  17.       headers: {
  18.         "Content-Type": "application/json",
  19.         "x-api-client-version": "4",
  20.         "user-agent":
  21.           "Mozilla/5.0 (Linux; Android 10; Redmi Note 5 Pro Build/QQ3A.200805.001) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.7204.179 Mobile Safari/537.36",
  22.         "x-requested-with": "com.chromasterZ.vn",
  23.         origin: "https://www.junia.ai",
  24.         referer: "https://www.junia.ai/tools/ai-speech-writer",
  25.         accept: "*/*",
  26.       },
  27.     });
  28.     return res.data;
  29.   } catch (err) {
  30.     console.error(err.response?.data || err.message);
  31.     throw new Error("Layanan Junia sedang error.");
  32.   }
  33. }
  34.  
  35. function cleanResult(text) {
  36.   if (!text) return text;
  37.   return text.replace(/\s?[0-9a-f]{4,}-[0-9a-f]{4,}$/i, "").trim();
  38. }
  39.  
  40. // FUNCTION NYA TERGANTUNG LU MAU MANGGIL YANG MANA
  41. async function aiSpeechWriter(details) {
  42.   if (!details) throw new Error("Details harus diisi untuk ai-speech-writer");
  43.   const res = await juniaRequest({ details, op: "ai-speech-writer" });
  44.   return cleanResult(res.result || res);
  45. }
  46.  
  47. async function recipeGenerator(details) {
  48.   if (!details) throw new Error("Details harus diisi untuk recipe-generator");
  49.   const res = await juniaRequest({ details, op: "recipe-generator" });
  50.   return cleanResult(res.result || res);
  51. }
  52.  
  53. async function projectNameGenerator(details) {
  54.   if (!details)
  55.     throw new Error("Details harus diisi untuk project-name-generator");
  56.   const res = await juniaRequest({ details, op: "project-name-generator" });
  57.   return cleanResult(res.result || res);
  58. }
  59.  
  60. async function bulletPointsGenerator(details) {
  61.   if (!details)
  62.     throw new Error("Details harus diisi untuk bullet-points-generator");
  63.   const res = await juniaRequest({ details, op: "bullet-points-generator" });
  64.   return cleanResult(res.result || res);
  65. }
  66.  
  67. async function aiDebateGenerator(details) {
  68.   if (!details) throw new Error("Details harus diisi untuk ai-debate-generator");
  69.   const res = await juniaRequest({ details, op: "ai-debate-generator" });
  70.   return cleanResult(res.result || res);
  71. }
  72.  
  73. async function imageToText({
  74.   url,
  75.   additionalDescription = "", //deskripsi bagian dari gambar
  76.   language = "Indonesian",
  77.   seoKeywords = "",
  78. }) {
  79.   if (!url) throw new Error("URL image harus diisi untuk op-image-to-text");
  80.   const res = await juniaRequest({
  81.     url,
  82.     additionalDescription,
  83.     language,
  84.     seoKeywords,
  85.     op: "op-image-to-text",
  86.   });
  87.   return cleanResult(res.result || res);
  88. }
  89.  
  90. async function humanize(content) {
  91.   if (!content) throw new Error("Content harus diisi untuk op-humanize");
  92.   const res = await juniaRequest({ content, op: "op-humanize" });
  93.   return cleanResult(res.result || res);
  94. }
  95.  
  96. async function promptImage(content) {
  97.   if (!content) throw new Error("Content harus diisi untuk op-prompt");
  98.   const res = await juniaRequest({ content, op: "op-prompt" });
  99.   return cleanResult(res.result || res);
  100. }
  101.  
  102. module.exports = {
  103.   aiSpeechWriter,
  104.   recipeGenerator,
  105.   projectNameGenerator,
  106.   bulletPointsGenerator,
  107.   aiDebateGenerator,
  108.   imageToText,
  109.   humanize,
  110.   promptImage,
  111. };
  112.  
  113. //contoh pemanggilan nya
  114. /*async function main() {
  115.   const speech = await aiSpeechWriter("Buat pidato singkat tentang kemerdekaan");
  116.   console.log("AI Speech Writer:", speech);
  117. }
  118.  
  119. main();*/
Add Comment
Please, Sign In to add comment