LucasMod

asuVeo31

Nov 9th, 2025
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 2.79 KB | Source Code | 0 0
  1. const axios = require('axios');
  2.  
  3. /**
  4.  * Asu Veo31 AI Video Generator
  5.  * Converte imagens em vídeos usando a API Veo31AI.
  6.  *
  7.  * @example
  8.  * // Command line usage
  9.  * node asuVeo31.js "a cat dancing" "https://example.com/cat.jpg"
  10.  *
  11.  * @By: 𖧄 𝐋𝐔𝐂𝐀𝐒 𝐌𝐎𝐃 𝐃𝐎𝐌𝐈𝐍𝐀 𖧄
  12.  * Canal: https://whatsapp.com/channel/0029Vb69bDnAe5VmzSMwBH11
  13.  *
  14.  */
  15. async function asuVeo31() {
  16. const prompt = process.argv[2];
  17. const image = process.argv[3];
  18.  
  19. if (!prompt || !image) {
  20. console.log('Uso: node asuVeo31.js "prompt" "image_url"');
  21. console.log('Exemplo: node asuVeo31.js "um gato dançando" "https://example.com/cat.jpg"');
  22. return;
  23. }
  24. const payload = {
  25. videoPrompt: prompt,
  26. videoAspectRatio: "16:9",
  27. videoDuration: 5,
  28. videoQuality: "540p",
  29. videoModel: "v4.5",
  30. videoImageUrl: image,
  31. videoPublic: false
  32. };
  33. try {
  34. console.log('Iniciando a geração de vídeo...');
  35. const gen = await axios.post('https://veo31ai.io/api/pixverse-token/gen', payload, {
  36. headers: { 'Content-Type': 'application/json' }
  37. });
  38. const taskId = gen.data.taskId;
  39. if (!taskId) {
  40. console.log('Falha ao criar a tarefa');
  41. return;
  42. }
  43. console.log(`Tarefa criada: ${taskId}`);
  44. console.log('Aguardando a geração do vídeo...');
  45. let videoUrl = null;
  46. const timeout = Date.now() + 180000; // 3 minutes timeout
  47. let attempts = 0;
  48. while (Date.now() < timeout) {
  49. attempts++;
  50. const res = await axios.post('https://veo31ai.io/api/pixverse-token/get', {
  51. taskId,
  52. videoPublic: false,
  53. videoQuality: "540p",
  54. videoAspectRatio: "16:9",
  55. videoPrompt: prompt
  56. }, {
  57. headers: { 'Content-Type': 'application/json' }
  58. });
  59. if (res.data?.videoData?.url) {
  60. videoUrl = res.data.videoData.url;
  61. console.log(`Vídeo gerado com sucesso após ${attempts} tentativas!`);
  62. break;
  63. }
  64. process.stdout.write(`Tentar ${attempts}: Vídeo ainda não está pronto....\r`);
  65. await new Promise(r => setTimeout(r, 5000));
  66. }
  67. if (!videoUrl) {
  68. console.log('\nVídeo não disponível ou falha ao gerar dentro do tempo limite..');
  69. return;
  70. }
  71. console.log('Video URL:', videoUrl);
  72. return videoUrl;
  73. } catch (error) {
  74. console.log('Error:', error.response?.data || error.message);
  75. }
  76. }
  77.  
  78. // Execute se este arquivo for executado diretamente.
  79. if (require.main === module) {
  80. asuVeo31();
  81. }
  82.  
  83. module.exports = asuVeo31
  84.  
  85. /*
  86. EXEMPLO DE USO:
  87.  
  88. 1. Como script direto:
  89. node asuVeo31.js "Um belo pôr do sol sobre as montanhas." "https://example.com/sunset.jpg"
  90.  
  91. const asuVeo31 = require('./asuVeo31');
  92.  
  93. async function generateVideo() {
  94. const videoUrl = await asuVeo31(
  95. "Um belo pôr do sol sobre as montanhas.",
  96. "https://example.com/sunset.jpg"
  97. );
  98. console.log('Generated video:', videoUrl);
  99. }
  100.  
  101. CARACTERÍSTICAS:
  102. - Gera vídeos de 5 segundos em qualidade 540p
  103. - Ratio 16:9
  104. - Usa modelo v4.5 do Veo31AI
  105. - Timeout de 3 minutos para geração
  106. */
Advertisement
Add Comment
Please, Sign In to add comment