Epikcoder
commited on
Commit
·
e410d5c
1
Parent(s):
0e6ea55
bansos
Browse files- api/index.js +33 -24
api/index.js
CHANGED
@@ -13,7 +13,7 @@ let twt_data = await axios.get(link_twt).then(r => r.data)
|
|
13 |
const link_ig = "https://raw.githubusercontent.com/Epikcoder/aru/main/ig.json"
|
14 |
let ig_data = await axios.get(link_ig).then(r => r.data)
|
15 |
app.use(cors())
|
16 |
-
app.get("/video", async(req,res) => {
|
17 |
let c = "" //get random data
|
18 |
let url = "";
|
19 |
function check() {
|
@@ -38,7 +38,7 @@ app.get("/video", async(req,res) => {
|
|
38 |
response.data.pipe(res);
|
39 |
})
|
40 |
|
41 |
-
app.get('/image',async(req,res)=>{
|
42 |
let c = "" //get random data
|
43 |
let url = "";
|
44 |
function check() {
|
@@ -69,11 +69,11 @@ app.get('/image',async(req,res)=>{
|
|
69 |
response.data.pipe(res);
|
70 |
})
|
71 |
|
72 |
-
app.get("/api", (req,res) => {
|
73 |
const a = twt_data[Math.floor(Math.random() * twt_data.length)].split("|")
|
74 |
-
res.json({ "urllink": a[2], "id": a[1], "name": a[0]
|
75 |
})
|
76 |
-
app.get("/video", async(req,res) => {
|
77 |
let c = "" //get random data
|
78 |
let url = "";
|
79 |
function check() {
|
@@ -98,7 +98,7 @@ app.get("/video", async(req,res) => {
|
|
98 |
response.data.pipe(res);
|
99 |
})
|
100 |
|
101 |
-
app.get('/igimage',async(req,res)=>{
|
102 |
let c = "" //get random data
|
103 |
let url = "";
|
104 |
function check() {
|
@@ -123,31 +123,40 @@ app.get('/igimage',async(req,res)=>{
|
|
123 |
response.data.pipe(res);
|
124 |
})
|
125 |
|
126 |
-
app.get("/igapi", (req,res) => {
|
127 |
const a = ig_data[Math.floor(Math.random() * ig_data.length)]
|
128 |
-
res.json({ "urllink": a
|
129 |
})
|
130 |
app.get("/", async (req, res) => {
|
131 |
const murl = req.headers["x-vercel-deployment-url"] || req.headers.referrer || req.headers.host
|
132 |
-
res.json({
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
|
|
|
|
140 |
})
|
141 |
|
142 |
-
app.get("/updb", async(req,res)=> {
|
143 |
-
const {data} = await axios.get(link_twt)
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
}
|
|
|
151 |
})
|
152 |
|
153 |
app.listen(port, () => {
|
|
|
13 |
const link_ig = "https://raw.githubusercontent.com/Epikcoder/aru/main/ig.json"
|
14 |
let ig_data = await axios.get(link_ig).then(r => r.data)
|
15 |
app.use(cors())
|
16 |
+
app.get("/video", async (req, res) => {
|
17 |
let c = "" //get random data
|
18 |
let url = "";
|
19 |
function check() {
|
|
|
38 |
response.data.pipe(res);
|
39 |
})
|
40 |
|
41 |
+
app.get('/image', async (req, res) => {
|
42 |
let c = "" //get random data
|
43 |
let url = "";
|
44 |
function check() {
|
|
|
69 |
response.data.pipe(res);
|
70 |
})
|
71 |
|
72 |
+
app.get("/api", (req, res) => {
|
73 |
const a = twt_data[Math.floor(Math.random() * twt_data.length)].split("|")
|
74 |
+
res.json({ "urllink": a[2], "id": a[1], "name": a[0] })
|
75 |
})
|
76 |
+
app.get("/video", async (req, res) => {
|
77 |
let c = "" //get random data
|
78 |
let url = "";
|
79 |
function check() {
|
|
|
98 |
response.data.pipe(res);
|
99 |
})
|
100 |
|
101 |
+
app.get('/igimage', async (req, res) => {
|
102 |
let c = "" //get random data
|
103 |
let url = "";
|
104 |
function check() {
|
|
|
123 |
response.data.pipe(res);
|
124 |
})
|
125 |
|
126 |
+
app.get("/igapi", (req, res) => {
|
127 |
const a = ig_data[Math.floor(Math.random() * ig_data.length)]
|
128 |
+
res.json({ "urllink": a })
|
129 |
})
|
130 |
app.get("/", async (req, res) => {
|
131 |
const murl = req.headers["x-vercel-deployment-url"] || req.headers.referrer || req.headers.host
|
132 |
+
res.json({
|
133 |
+
madeBy: "@EpikCoder", mainurl: murl, routes: [
|
134 |
+
murl + "/image",
|
135 |
+
murl + "/api",
|
136 |
+
murl + "/video",
|
137 |
+
murl + "/igimage",
|
138 |
+
murl + "/igapi",
|
139 |
+
murl + "/igvideo"
|
140 |
+
]
|
141 |
+
})
|
142 |
})
|
143 |
|
144 |
+
app.get("/updb", async (req, res) => {
|
145 |
+
const { data } = await axios.get(link_twt)
|
146 |
+
const { data: igs_data } = await axios.get(link_twt)
|
147 |
+
if(data.length != twt_data.length || igs_data != ig_data.length) {
|
148 |
+
if (data.length != twt_data.length) {
|
149 |
+
twt_data = data;
|
150 |
+
res.write("updb twt")
|
151 |
+
}
|
152 |
+
if(igs_data != ig_data.length) {
|
153 |
+
ig_data = igs_data
|
154 |
+
res.write("updb ig")
|
155 |
+
}
|
156 |
+
}else{
|
157 |
+
res.send("no update")
|
158 |
}
|
159 |
+
|
160 |
})
|
161 |
|
162 |
app.listen(port, () => {
|