-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
344 lines (278 loc) · 8.06 KB
/
index.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
const express = require("express");
const axios = require("axios");
const cheerio = require("cheerio");
const app = express();
const port = 3000;
app.get("/", (req, res) => {
res.type("json");
const keluaran = {
success: true,
author: "Eksa Dev",
sumber: "https://otakudesu.ltd/",
pesan:
"Kami mohon izin kepada pihak otakudesu untuk mengambil data dari web kalian",
data: {
Ambil_anime_terbaru: "/terbaru",
Ambil_detail_anime: "/detail/:endpoint",
Ambil_stream_anime: "/stream/:endpoint",
Ambil_search_anime: "/search/:namaanime",
Ambil_all_kategori_list: "/genrelist",
Ambil_data_genre: "/genres/:endpoint",
},
};
res.send(keluaran);
});
app.get("/terbaru", (req, res) => {
res.type("json");
getDataAnime().then((result) => {
res.send(result);
});
});
app.get("/anime/:namanime", (req, res) => {
res.type('json')
const url = req.params.namanime;
getDetailAnime(url).then((result) => {
res.send(result);
});
});
app.get("/stream/:namanime", (req, res) => {
const url = req.params.namanime;
streamNime(url).then((result) => {
res.send(result);
});
});
app.get("/search/:nama", (req, res) => {
const url = req.params.nama;
searchNime(url).then((result) => {
res.send(result);
});
});
app.get("/genrelist", (req, res) => {
kategoriList().then((response) => {
res.send(response);
});
});
app.get("/genres/:nama/page/:hal", (req, res) => {
const nama = req.params.nama;
const hal = req.params.hal;
genres(nama, hal).then((response) => {
res.send(response);
});
});
async function getDataAnime() {
let { data } = await axios.get("https://otakudesu.cloud");
const $ = cheerio.load(data);
let arr = [];
const venz = $(".venz")
.first()
.find(".detpost")
.each((index, element) => {
const jj = $(element).find(".jdlflm").text();
const hariUpload = $(element).find(".epztipe").text();
const episodeKe = $(element).find(".epz").text();
const tanggalUp = $(element).find(".newnime").text();
const thumbnail = $(element).find("img").attr("src");
let endpoint = $(element).find("a").attr("href");
endpoint = endpoint.split("/")[4];
arr.push({
id: index + 1,
judul: jj,
hariUp: hariUpload,
episodeBaru: episodeKe,
tanggalUpload: tanggalUp,
thumb: thumbnail,
endpoint: endpoint,
});
});
let objek = {
success: true,
author: "Eksa Dev",
sumber: "https://otakudesu.ltd/",
pesan:
"Kami mohon izin kepada pihak otakudesu untuk mengambil data dari web kalian",
data: {
arr,
},
};
return objek;
}
async function getDetailAnime(anime) {
const url = `https://otakudesu.cloud/anime/${anime}/`
let { data } = await axios.get(url);
// const $ = cheerio.load(data);
let arr = [];
// let arr2 = [];
// const fotonime = $(".venser").find(".fotoanime img").attr("src");
// const judul = $(".venser").find(".infozingle p").first().text();
// const skor = $(".venser").find(".infozingle p:nth-child(3)").text();
// const produser = $(".venser").find(".infozingle p:nth-child(4)").text();
// const status = $(".venser").find(".infozingle p:nth-child(6)").text();
// const totaleps = $(".venser").find(".infozingle p:nth-child(7)").text();
// const studio = $(".venser").find(".infozingle p:nth-child(10)").text();
// const genre = $(".venser").find(".infozingle p:nth-child(11)").text();
// const sinopsis = $(".venser").find(".sinopc").text();
// $(".venser .episodelist ul li").each((index, element) => {
// const episod = $(element).find("a").text();
// let endpoint = $(element).find("a").attr("href");
// endpoint = endpoint.split("/")[4];
// arr2.push({
// id: index + 1,
// title: episod,
// endpoint: endpoint,
// });
// });
// arr.push({
// fotonime: fotonime,
// judul: judul,
// skor: skor,
// produser: produser,
// status: status,
// totaleps: totaleps,
// studio: studio,
// genre: genre,
// sinopsis: sinopsis,
// // episodelist: arr2,
// });
let objek = {
success: true,
author: "Eksa Dev",
sumber: "https://otakudesu.ltd/",
pesan:
"Kami mohon izin kepada pihak otakudesu untuk mengambil data dari web kalian",
data: {
arr,
},
};
return objek;
}
async function streamNime(url) {
const { data } = await axios.get("https://otakudesu.cloud/episode/" + url);
const $ = cheerio.load(data);
const arr = [];
const download = [];
const jdlflm = $(".venser").find(".posttl").text();
const iframe = $(".responsive-embed-stream iframe").attr("src");
const el = $(".venser").find(".download ul").html();
download.push(el);
arr.push({
judul: jdlflm,
iframe: iframe,
link: download,
});
let objek = {
success: true,
author: "Eksa Dev",
sumber: "https://otakudesu.ltd/",
pesan:
"Kami mohon izin kepada pihak otakudesu untuk mengambil data dari web kalian",
data: {
arr,
},
};
return objek;
}
const searchNime = async (url) => {
const { data } = await axios.get(
`https://otakudesu.cloud/?s=${url}&post_type=anime`
);
const $ = cheerio.load(data);
const arr = [];
$(".chivsrc li").each((index, element) => {
const thumb = $(element).find("img").attr("src");
const nama = $(element).find("a").first().text();
const genres = $(element).find(".set").first().text();
const status = $(element).find("div:nth-child(4)").text();
const rating = $(element).find("div:nth-child(5)").text();
let endpoint = $(element).find("a").attr("href");
endpoint = endpoint.split("/")[4];
arr.push({
id: index + 1,
thumb: thumb,
nama: nama,
genres: genres,
status: status,
rating: rating,
endpoint: endpoint,
});
});
let objek = {
success: true,
author: "Eksa Dev",
sumber: "https://otakudesu.ltd/",
pesan:
"Kami mohon izin kepada pihak otakudesu untuk mengambil data dari web kalian",
data: {
arr,
},
};
return objek;
};
const kategoriList = async () => {
const { data } = await axios.get(`https://otakudesu.cloud/genre-list/`);
const $ = cheerio.load(data);
const arr = [];
$(".genres li a").each((index, element) => {
const nama = $(element).text();
const endpoint = $(element).attr("href").split("/")[2];
arr.push({
id: index + 1,
nama: nama,
endpoint: endpoint,
});
});
let objek = {
success: true,
author: "Eksa Dev",
sumber: "https://otakudesu.ltd/",
pesan:
"Kami mohon izin kepada pihak otakudesu untuk mengambil data dari web kalian",
data: {
arr,
},
};
return objek;
};
const genres = async (nama, hal) => {
const { data } = await axios.get(`https://otakudesu.cloud/genres/${nama}/page/${hal}`);
const $ = cheerio.load(data);
const arr = [];
$(".col-anime-con").each((index, element) => {
const nama = $(element).find(".col-anime .col-anime-title").text();
const studio = $(element).find(".col-anime .col-anime-studio").text();
const eps = $(element).find(".col-anime .col-anime-eps").text();
const rating = $(element).find(".col-anime .col-anime-rating").text();
const genre = $(element).find(".col-anime .col-anime-genre").text();
const synopsis = $(element).find(".col-anime .col-synopsis").text();
const thumb = $(element)
.find(".col-anime .col-anime-cover img")
.attr("src");
const endpoint = $(element)
.find(".col-anime .col-anime-title a")
.attr("href")
.split("/")[4];
arr.push({
nama: nama,
thumb: thumb,
studio: studio,
eps: eps,
rating: rating,
genre: genre,
synopsis: synopsis,
endpoint: endpoint,
});
});
let objek = {
success: true,
author: "Eksa Dev",
sumber: "https://otakudesu.ltd/",
pesan:
"Kami mohon izin kepada pihak otakudesu untuk mengambil data dari web kalian",
data: {
arr,
},
};
return objek;
};
app.listen(port, () => {
console.log(`Listen on port ${port}`);
});