Ayogiakbar

Generator Song Ai

Sep 3rd, 2025 (edited)
393
0
Never
8
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Generator Song AI - Sunora Ai
  3.  * Author : gienetic
  4.  * Base   : https://play.google.com/store/apps/details?id=com.mavtao.ai.song.generator.maker.sunora
  5.  * Note   : -
  6.  */
  7.  
  8.  
  9. const axios = require("axios");
  10. const { v4: uuidv4 } = require("uuid");
  11.  
  12. function randomHex(length) {
  13.   const chars = "abcdef0123456789";
  14.   return Array.from({ length }, () => chars[Math.floor(Math.random() * chars.length)]).join("");
  15. }
  16.  
  17. function gieneticTrace() {
  18.   return `${randomHex(32)}-${randomHex(16)}`;
  19. }
  20.  
  21. // Auto regist
  22. async function login(deviceId) {
  23.   const res = await axios.post(
  24.     "https://api.sunora.mavtao.com/api/auth/login",
  25.     { device_id: deviceId },
  26.     {
  27.       headers: {
  28.         "user-agent": "Dart/3.4 (gienetic_build)",
  29.         "version": "2.2.2",
  30.         "accept-encoding": "gzip",
  31.         "content-type": "application/json",
  32.         "buildnumber": "105",
  33.         "platform": "android",
  34.         "sentry-trace": gieneticTrace()
  35.       }
  36.     }
  37.   );
  38.   return res.data?.data?.token || null;
  39. }
  40.  
  41. // Polling hasil
  42. async function polllll(xAuth, maxAttempts = 30, delayMs = 30000) {
  43.   for (let attempt = 1; attempt <= maxAttempts; attempt++) {
  44.     try {
  45.       const res = await axios.get(
  46.         "https://api.sunora.mavtao.com/api/music/music_page?page=1&pagesize=50",
  47.         {
  48.           headers: {
  49.             "user-agent": "Dart/3.4 (gienetic_build)",
  50.             "version": "2.2.2",
  51.             "accept-encoding": "gzip",
  52.             "x-auth": xAuth,
  53.             "buildnumber": "105",
  54.             "platform": "android",
  55.             "sentry-trace": gieneticTrace()
  56.           }
  57.         }
  58.       );
  59.  
  60.       const records = res.data?.data?.records || [];
  61.       const doneSongs = records.filter(r => r.status === "complete");
  62.  
  63.       if (doneSongs.length > 0) {
  64.         return doneSongs.map(r => ({
  65.           id: r.song_id,
  66.           title: r.title || "Sniff By: Gienetic",
  67.           tags: r.meta_tags,
  68.           prompt: r.meta_prompt,
  69.           audioUrl: r.audio_url,
  70.           videoUrl: r.video_url,
  71.           imageUrl: r.image_url,
  72.           model: r.model_name
  73.         }));
  74.       }
  75.     } catch (err) {
  76.       console.error("⚠️ Polling error:", err.response?.data || err.message);
  77.     }
  78.     await new Promise(r => setTimeout(r, delayMs));
  79.   }
  80.   return [];
  81. }
  82.  
  83. // Mode Prompt (bebas)
  84. async function generateNormal(description) {
  85.   const deviceId = uuidv4();
  86.   const token = await login(deviceId);
  87.   if (!token) throw new Error("⚠️ Error: gagal login (makanya tag author ny kalau recode :v)");
  88.  
  89.   await axios.post(
  90.     "https://api.sunora.mavtao.com/api/music/advanced_custom_generate",
  91.     {
  92.       continue_at: null,
  93.       continue_clip_id: null,
  94.       mv: null,
  95.       description,
  96.       title: "",
  97.       mood: "",
  98.       music_style: "",
  99.       instrumental_only: false
  100.      
  101.     },
  102.     {
  103.       headers: {
  104.         "user-agent": "Dart/3.4 (gienetic_build)",
  105.         "version": "2.2.2",
  106.         "accept-encoding": "gzip",
  107.         "x-auth": token,
  108.         "content-type": "application/json",
  109.         "buildnumber": "105",
  110.         "platform": "android",
  111.         "sentry-trace": gieneticTrace()
  112.       }
  113.     }
  114.   );
  115.  
  116.   return await polllll(token);
  117. }
  118.  
  119. // Mode Lirik Custom
  120. async function generateCustom({ title, style, lyrics }) {
  121.   const deviceId = uuidv4();
  122.   const token = await login(deviceId);
  123.   if (!token) throw new Error("⚠️ Error: gagal login (makanya tag author ny kalau recode :v)");
  124.  
  125.   await axios.post(
  126.     "https://api.sunora.mavtao.com/api/music/custom_generate",
  127.     {
  128.       continue_at: null,
  129.       continue_clip_id: null,
  130.       mv: null,
  131.       prompt: lyrics,
  132.       title,
  133.       tags: style
  134.     },
  135.     {
  136.       headers: {
  137.         "user-agent": "Dart/3.4 (gienetic_build)",
  138.         "version": "2.2.2",
  139.         "accept-encoding": "gzip",
  140.         "x-auth": token,
  141.         "content-type": "application/json",
  142.         "buildnumber": "105",
  143.         "platform": "android",
  144.         "sentry-trace": gieneticTrace()
  145.       }
  146.     }
  147.   );
  148.  
  149.   return await polllll(token);
  150. }
  151.  
  152. // Mode Instrumental
  153. async function generateInstrumental(description) {
  154.   const deviceId = uuidv4();
  155.   const token = await login(deviceId);
  156.   if (!token) throw new Error("⚠️ Error: gagal login (makanya tag author ny kalau recode :v)");
  157.  
  158.   await axios.post(
  159.     "https://api.sunora.mavtao.com/api/music/advanced_custom_generate",
  160.     {
  161.       continue_at: null,
  162.       continue_clip_id: null,
  163.       mv: null,
  164.       description,
  165.       title: "",
  166.       mood: "",
  167.       music_style: "",
  168.       instrumental_only: true
  169.     },
  170.     {
  171.       headers: {
  172.         "user-agent": "Dart/3.4 (gienetic_build)",
  173.         "version": "2.2.2",
  174.         "accept-encoding": "gzip",
  175.         "x-auth": token,
  176.         "content-type": "application/json",
  177.         "buildnumber": "105",
  178.         "platform": "android",
  179.         "sentry-trace": gieneticTrace()
  180.       }
  181.     }
  182.   );
  183.  
  184.   return await polllll(token);
  185. }
  186.  
  187. module.exports = {
  188.   generateNormal,
  189.   generateCustom,
  190.   generateInstrumental
  191. };
  192.  
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
Add Comment
Please, Sign In to add comment