1.0.17 • Published 10 months ago

@omoti/pix-ai v1.0.17

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

本パッケージはこれの TS|JS 版です

EN

インストール

npm install @omoti/pix-ai

アカウント生成のコード

import { PixAI } from '@omoti/pix-ai';

async function sleep(ms: number) {
    return new Promise(resolve => setTimeout(resolve, ms));
}

let pix:PixAI;

async function createPixAIAccount() {
    try {
        const email = "example@example.com"
        const pass = "password"
        
        pix = new PixAI(mail,pass,false); //最後のbooleanがtrueだとloginになる
        
        await sleep(5000);

        console.log(`Email: ${email}`);
        console.log(`Password: ${pass}`);        
        await sleep(10000);

        await pix.claimDailyQuota(); // Daily Quotaの取得
        await pix.claimQuestionnaireQuota(); // アンケートを答えるともらえるQuotaの取得
        console.log(await pix.getQuota()); // Quotaの表示正常だと28000Quotaもらえるはず
    } catch (error) {
        console.error(error);
    }
}

createPixAIAccount();

画像生成の元

import { PixAI } from "@omoti/pix-ai";

async function generateAndFetchMedia(prompt:string) {
    try {
        const pix = new PixAI("You Email","You password",true) // login
        setTimeout(async() => {
            const queryId = await pix.generateImage(args.prompt); // 画像生成のリクエスト
            console.log(`Generated Query ID: ${queryId}`);
    
            let mediaIds: string[] | null = null;
    
            while (mediaIds === null) {
                mediaIds = await pix.getTaskById(queryId); // タスクIDを取得
                if (mediaIds === null) {
                    console.log("Task is still processing, waiting...");
                    await new Promise(resolve => setTimeout(resolve, 5000));
                }
            }
    
            for (const mediaId of mediaIds) {
                const media = await pix.getMedia(mediaId); // 生成されたurlの表示
                console.log(media);
    
                const quota = await pix.getQuota(); // Quotaの表示
                console.log(quota);
            }
        }, 5000);
    } catch (error) {
        console.error("Error occurred:", error);
    }
}

generateAndFetchMedia("apple")

Update Notes:

- Removed Recaptcha Logs
+ Added get_token() method // return this.token
+ Added README EN Version
1.0.17

10 months ago

1.0.16

10 months ago

1.0.11

10 months ago

1.0.15

10 months ago

1.0.13

10 months ago

1.0.12

10 months ago

1.0.2

10 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.10

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago