Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Tools Ai - Web
- * Author : gienetic
- * Base : https://www.junia.ai
- */
- const axios = require("axios");
- const Base_Api = "https://www.junia.ai/api/free-tools/generate";
- async function juniaRequest(payload) {
- if (!payload || !payload.op)
- throw new Error("Payload harus ada dan minimal berisi field op");
- try {
- const res = await axios.post(Base_Api, payload, {
- headers: {
- "Content-Type": "application/json",
- "x-api-client-version": "4",
- "user-agent":
- "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",
- "x-requested-with": "com.chromasterZ.vn",
- origin: "https://www.junia.ai",
- referer: "https://www.junia.ai/tools/ai-speech-writer",
- accept: "*/*",
- },
- });
- return res.data;
- } catch (err) {
- console.error(err.response?.data || err.message);
- throw new Error("Layanan Junia sedang error.");
- }
- }
- function cleanResult(text) {
- if (!text) return text;
- return text.replace(/\s?[0-9a-f]{4,}-[0-9a-f]{4,}$/i, "").trim();
- }
- // FUNCTION NYA TERGANTUNG LU MAU MANGGIL YANG MANA
- async function aiSpeechWriter(details) {
- if (!details) throw new Error("Details harus diisi untuk ai-speech-writer");
- const res = await juniaRequest({ details, op: "ai-speech-writer" });
- return cleanResult(res.result || res);
- }
- async function recipeGenerator(details) {
- if (!details) throw new Error("Details harus diisi untuk recipe-generator");
- const res = await juniaRequest({ details, op: "recipe-generator" });
- return cleanResult(res.result || res);
- }
- async function projectNameGenerator(details) {
- if (!details)
- throw new Error("Details harus diisi untuk project-name-generator");
- const res = await juniaRequest({ details, op: "project-name-generator" });
- return cleanResult(res.result || res);
- }
- async function bulletPointsGenerator(details) {
- if (!details)
- throw new Error("Details harus diisi untuk bullet-points-generator");
- const res = await juniaRequest({ details, op: "bullet-points-generator" });
- return cleanResult(res.result || res);
- }
- async function aiDebateGenerator(details) {
- if (!details) throw new Error("Details harus diisi untuk ai-debate-generator");
- const res = await juniaRequest({ details, op: "ai-debate-generator" });
- return cleanResult(res.result || res);
- }
- async function imageToText({
- url,
- additionalDescription = "", //deskripsi bagian dari gambar
- language = "Indonesian",
- seoKeywords = "",
- }) {
- if (!url) throw new Error("URL image harus diisi untuk op-image-to-text");
- const res = await juniaRequest({
- url,
- additionalDescription,
- language,
- seoKeywords,
- op: "op-image-to-text",
- });
- return cleanResult(res.result || res);
- }
- async function humanize(content) {
- if (!content) throw new Error("Content harus diisi untuk op-humanize");
- const res = await juniaRequest({ content, op: "op-humanize" });
- return cleanResult(res.result || res);
- }
- async function promptImage(content) {
- if (!content) throw new Error("Content harus diisi untuk op-prompt");
- const res = await juniaRequest({ content, op: "op-prompt" });
- return cleanResult(res.result || res);
- }
- module.exports = {
- aiSpeechWriter,
- recipeGenerator,
- projectNameGenerator,
- bulletPointsGenerator,
- aiDebateGenerator,
- imageToText,
- humanize,
- promptImage,
- };
- //contoh pemanggilan nya
- /*async function main() {
- const speech = await aiSpeechWriter("Buat pidato singkat tentang kemerdekaan");
- console.log("AI Speech Writer:", speech);
- }
- main();*/
Add Comment
Please, Sign In to add comment