Script Get Otp & Nokos
javascript2 jam lalu 37 dilihat 8 disalin
const axios = require("axios");
const BASE_URL = "https://allapiproject.zone.id/api/gacha";
class GachaAPI {
static async getNumbers() {
try {
const { data } = await axios.get(`${BASE_URL}/numbers`, {
headers: {
Accept: "application/json",
"User-Agent": "Mozilla/5.0"
}
});
return data;
} catch (err) {
throw new Error(
err.response?.data?.message || err.message
);
}
}
static async getOtps(limit = 20) {
try {
const { data } = await axios.get(`${BASE_URL}/otps`, {
params: { limit },
headers: {
Accept: "application/json",
"User-Agent": "Mozilla/5.0"
}
});
return data;
} catch (err) {
throw new Error(
err.response?.data?.message || err.message
);
}
}
}
(async () => {
try {
const numbers = await GachaAPI.getNumbers();
console.log("=== Numbers ===");
console.log(numbers);
const otps = await GachaAPI.getOtps(20);
console.log("\n=== OTPs ===");
console.log(otps);
} catch (e) {
console.error(e.message);
}
})();