Spaces:
Sleeping
Sleeping
Update plugins/sora2.js
Browse files- plugins/sora2.js +17 -8
plugins/sora2.js
CHANGED
|
@@ -259,10 +259,17 @@ async function registerAccount(email, password, verificationCode) {
|
|
| 259 |
}
|
| 260 |
|
| 261 |
console.log('Account registered successfully');
|
| 262 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
}
|
| 264 |
|
| 265 |
-
async function
|
| 266 |
console.log('Creating video task...');
|
| 267 |
await randomDelay(2000, 3000);
|
| 268 |
|
|
@@ -291,7 +298,7 @@ async function createVideo(prompt, ratio, authToken, email) {
|
|
| 291 |
});
|
| 292 |
|
| 293 |
if (data.code !== 200) {
|
| 294 |
-
throw new Error(`Failed to create video: ${data.message || 'Unknown error'}`);
|
| 295 |
}
|
| 296 |
|
| 297 |
console.log(`Video task created with ID: ${data.data}`);
|
|
@@ -361,17 +368,19 @@ async function sora2(prompt, ratio = 'portrait') {
|
|
| 361 |
|
| 362 |
await sendVerificationEmail(email);
|
| 363 |
const verificationCode = await getVerificationCode(email);
|
| 364 |
-
const
|
| 365 |
-
|
| 366 |
-
|
|
|
|
|
|
|
| 367 |
|
| 368 |
console.log('=== Video Generation Completed ===');
|
| 369 |
console.log(`Video URL: ${videoUrl}`);
|
| 370 |
|
| 371 |
return {
|
| 372 |
success: true,
|
| 373 |
-
email: email,
|
| 374 |
-
password: password,
|
| 375 |
videoUrl: videoUrl,
|
| 376 |
taskId: taskId
|
| 377 |
};
|
|
|
|
| 259 |
}
|
| 260 |
|
| 261 |
console.log('Account registered successfully');
|
| 262 |
+
console.log(`Email: ${email}`);
|
| 263 |
+
console.log(`Password: ${password}`);
|
| 264 |
+
|
| 265 |
+
return {
|
| 266 |
+
token: data.data.token,
|
| 267 |
+
email: email,
|
| 268 |
+
password: password
|
| 269 |
+
};
|
| 270 |
}
|
| 271 |
|
| 272 |
+
async function createVideoTask(prompt, ratio, authToken, email) {
|
| 273 |
console.log('Creating video task...');
|
| 274 |
await randomDelay(2000, 3000);
|
| 275 |
|
|
|
|
| 298 |
});
|
| 299 |
|
| 300 |
if (data.code !== 200) {
|
| 301 |
+
throw new Error(`Failed to create video task: ${data.message || 'Unknown error'}`);
|
| 302 |
}
|
| 303 |
|
| 304 |
console.log(`Video task created with ID: ${data.data}`);
|
|
|
|
| 368 |
|
| 369 |
await sendVerificationEmail(email);
|
| 370 |
const verificationCode = await getVerificationCode(email);
|
| 371 |
+
const result = await registerAccount(email, password, verificationCode);
|
| 372 |
+
|
| 373 |
+
console.log('=== Creating Video Task ===');
|
| 374 |
+
const taskId = await createVideoTask(prompt, ratio, result.token, result.email);
|
| 375 |
+
const videoUrl = await waitForVideoCompletion(taskId, result.token);
|
| 376 |
|
| 377 |
console.log('=== Video Generation Completed ===');
|
| 378 |
console.log(`Video URL: ${videoUrl}`);
|
| 379 |
|
| 380 |
return {
|
| 381 |
success: true,
|
| 382 |
+
email: result.email,
|
| 383 |
+
password: result.password,
|
| 384 |
videoUrl: videoUrl,
|
| 385 |
taskId: taskId
|
| 386 |
};
|