Ayogiakbar

TO FIGURE ONLY

Oct 24th, 2025
59
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * TO FIGURE - PICJOURNEY
  3.  * Author : Gienetic
  4.  * Base   : https://play.google.com/store/apps/details?id=com.picjourney.ai.avatar.generator.photo.maker
  5.  * Note : Hanya tofigure, bukan edit image dengan prompt, memang dari apk nya gitu,
  6.  */
  7.  
  8.  
  9. const axios = require("axios")
  10. const fs = require("fs")
  11. const FormData = require("form-data")
  12.  
  13. const AUTH_TOKEN = "68Gi7PI7gvkx8vovvzSfo1GW8QkqZHQWlfrIme5qA6lHCyVrlfJvm7ojZfrGKSHwDmU4HlklwYqaH8F/QaerlDgIJF3sC+qv4pUWcPIgql3yZgStWVeTNhl8kQq8TXDB3d18uyah1Y8E0JOpznCe3fxqv4y23AmUJyZq9uML/WjDyI5cYUFi9HdKsANOQSqim9uaEPqfUl/7yEE/HwnhP0Pmv0SxFu8r4tFx71ERCM2LGtpIGh8EGYknQjMEsXBFIgyFGnxKpQ/a7XUt5z26l1RYGRma03godmcPgIW0tquaSKQ5DeRBfvW+xKvM0F7XutE7TsQ7EJ3HvD0GNYQcb06Ft33jQZFAsqM5Gc/hI70yrzF9e6BaMjjetYfWoD1S";
  14.  
  15. async function toFigure(filePath) {
  16.   try {
  17.     // SENGAJA PAKE UPLOAD DI SERVER ASLI NYA BIAR AMAN, KALO MAU PAKE INPUT URL LAEN SILAHKAN AJA, BEBAS
  18.     const form = new FormData();
  19.     form.append("image", fs.createReadStream(filePath), {
  20.       filename: filePath.split("/").pop(),
  21.       contentType: "image/*"
  22.     });
  23.  
  24.     const uploadRes = await axios.post("http://43.230.202.197:3033/upload", form, {
  25.       headers: {
  26.         ...form.getHeaders(),
  27.         Authorization: `Bearer ${AUTH_TOKEN}`,
  28.         appName: "picjourney",
  29.         appVersionCode: "18"
  30.       }
  31.     })
  32.  
  33.     const { url } = uploadRes.data;
  34.     console.log("Upload:", url)
  35.  
  36.     // MEMBUAT FIGURE MYA
  37.     const startfigure = await axios.post(
  38.       "https://api.magicaigallery.com/v2/aiApi/faceSwap",
  39.       {
  40.         packId: "68c2cef4beee35e738a801db",
  41.         image_url: url
  42.       },
  43.       {
  44.         headers: {
  45.           Authorization: `Bearer ${AUTH_TOKEN}`,
  46.           appName: "picjourney",
  47.           appVersionCode: "18",
  48.           "Content-Type": "application/json; charset=UTF-8"
  49.         }
  50.       }
  51.     );
  52.  
  53.     const resultUrl = startfigure.data.data.fileUrl
  54.     console.log("Hasil :", resultUrl)
  55.  
  56.     return resultUrl
  57.   } catch (err) {
  58.     console.error("āŒ Ada yang salah:", err.response?.data || err.message)
  59.     throw err
  60.   }
  61. }
  62.  
  63. module.exports = toFigure
  64.  
  65. /* EXAMPLE:
  66.   const result = await toFigure("./input.jpg")
  67.   console.log("\nšŸ”— URL hasil :", result)
Add Comment
Please, Sign In to add comment