NekonekoID commited on
Commit
91906f9
·
verified ·
1 Parent(s): 7180a58

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +42 -0
index.js CHANGED
@@ -137,6 +137,19 @@ app.all(['/enhance', '/hd', '/upscale'], async (req, res) => {
137
  }
138
  })
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  app.all('/stablediff/illusion', async (req, res) => {
141
  if (!['GET', 'POST'].includes(req.method)) return res.status(405).json({ success: false, message: 'Method Not Allowed' })
142
 
@@ -230,6 +243,35 @@ function toPDF(urls) {
230
  })
231
  }
232
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  async function enhanceImage(url) {
234
  const browser = await playwright.chromium.launch({
235
  headless: true,
 
137
  }
138
  })
139
 
140
+ app.all(['/animelast', '/animesail'], async (req, res) => {
141
+ if (!['GET', 'POST'].includes(req.method)) return res.status(405).json({ success: false, message: 'Method Not Allowed' })
142
+
143
+ try {
144
+ const result = await scrapeAnimeInfo()
145
+ res.json({ success: true, result })
146
+ } catch (e) {
147
+ console.log(e)
148
+ e = String(e)
149
+ res.status(500).json({ error: true, message: e === '[object Object]' ? 'Internal Server Error' : e })
150
+ }
151
+ })
152
+
153
  app.all('/stablediff/illusion', async (req, res) => {
154
  if (!['GET', 'POST'].includes(req.method)) return res.status(405).json({ success: false, message: 'Method Not Allowed' })
155
 
 
243
  })
244
  }
245
 
246
+ async function scrapeAnimeInfo() {
247
+ const browser = await playwright.chromium.launch();
248
+ const page = await browser.newPage();
249
+ const url = 'https://154.26.137.28/rilisan-anime-terbaru/';
250
+
251
+ await page.goto(url);
252
+ await page.waitForSelector('.postbody');
253
+
254
+ const articlesInfo = await page.$$eval('.postbody .is-anime', articles => {
255
+ return articles.map(article => {
256
+ const title = article.querySelector('h2').textContent.trim();
257
+ const thumbnailUrl = article.querySelector('img').src;
258
+ const uploadTime = article.querySelector('span x-ts').textContent.trim();
259
+ const episodeUrl = article.querySelector('a').href;
260
+
261
+ return {
262
+ title,
263
+ thumbnailUrl,
264
+ uploadTime,
265
+ episodeUrl
266
+ };
267
+ });
268
+ });
269
+
270
+ await browser.close();
271
+
272
+ return articlesInfo;
273
+ }
274
+
275
  async function enhanceImage(url) {
276
  const browser = await playwright.chromium.launch({
277
  headless: true,