-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
127 lines (117 loc) · 3.03 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
const express = require("express");
const axios = require("axios")
const cheerio = require("cheerio")
const app = express();
app.use(express.json());
app.get("/", (req, res) => {
try {
res.status(200).send({
status: true,
msg: "Selamat datang di REST API YOGSSTORE",
creator: "https://www.instagram.com/avrzll_",
services: [
{ name: "Cek ID Games", url: "/cekidgame" },
{ name: "Cek Nama Dompet Digital", url: "/cekdompetdigital" }
]
})
} catch (error) {
console.error("Terjadi kesalahan:", error.message);
res.status(500).send({
status: false,
msg: `Terjadi kesalahan ${error.message}`
});
}
})
app.get("/cekidgame", (req, res) => {
try {
res.send({
status: true,
msg: "Gunakan API seperlunya.",
creator: "https://www.instagram.com/avrzll_",
games: [
{
name: "Free Fire",
endpoint: "/free-fire/?id=1685084111",
method: "GET"
},
{
name: "Mobile Legends",
endpoint: "Cooming Soon",
method: "Cooming Soon"
},
{
name: "PUBG Mobile",
endpoint: "Cooming Soon",
method: "Cooming Soon"
}
]
});
} catch (error) {
console.error("Terjadi kesalahan:", error.message);
res.status(500).send({
status: false,
msg: `Terjadi kesalahan ${error.message}`
});
}
});
app.get("/cekdompetdigital", (req, res) => {
try {
res.send({
status: true,
msg: "Cooming Soon",
creator: "https://www.instagram.com/avrzll_"
});
} catch (error) {
console.error("Terjadi kesalahan:", error.message);
res.status(500).send({
status: false,
msg: `Terjadi kesalahan ${error.message}`
});
}
});
app.get("/cekidgame/free-fire", async (req, res) => {
try {
const { id } = req.query;
const { data } = await axios.post(
"https://duniatopupgames.com/games/order/get-detail/66",
{
user_id: id,
zone_id: "1",
method: "balance",
wa: "085174422041",
voucher: ""
},
{
headers: {
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
}
}
);
const idResult = data.msg;
if (data.status) {
const $ = cheerio.load(idResult);
const username = $("table > tbody > tr:nth-child(3) > td:nth-child(3)").text();
res.status(200).send({
status: true,
msg: "Username ditemukan!",
result: username,
creator: "https://www.instagram.com/avrzll_"
});
} else {
res.status(200).send({
status: false,
msg: "Username tidak ditemukan!",
creator: "https://www.instagram.com/avrzll_"
});
}
} catch (error) {
console.error("Terjadi kesalahan:", error.message);
res.status(500).send({
status: false,
msg: `Terjadi kesalahan ${error.message}`
});
}
});
app.listen(3000, () => {
console.log("Server listening on port 3000");
});