NekonekoID commited on
Commit
714a1d8
·
verified ·
1 Parent(s): 978c238

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +27 -0
index.js CHANGED
@@ -11,6 +11,7 @@ import PDFDocument from 'pdfkit'
11
  import sharp from 'sharp'
12
  import util from 'util'
13
  import yts from 'yt-search'
 
14
 
15
  const utils = {
16
  getBrowser: (...opts) =>
@@ -238,6 +239,32 @@ app.all(/^\/(brat|carbon)/, async (req, res) => {
238
  }
239
  })
240
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  app.all('/mediafire', async (req, res) => {
242
  if (!['GET', 'POST'].includes(req.method))
243
  return res
 
11
  import sharp from 'sharp'
12
  import util from 'util'
13
  import yts from 'yt-search'
14
+ import urlebird from './lib/urlebird.js';
15
 
16
  const utils = {
17
  getBrowser: (...opts) =>
 
239
  }
240
  })
241
 
242
+ app.get('/tiktok/:type', async (req, res) => {
243
+ try {
244
+ if (/^latest_video$/i.test(req.params.type)) {
245
+ let result = await urlebird.latest()
246
+ return res.json({ result })
247
+ } else if (/^popular_video$/i.test(req.params.type)) {
248
+ let result = await urlebird.popular()
249
+ return res.json({ result })
250
+ } else if (/^trending_video$/i.test(req.params.type)) {
251
+ let result = await urlebird.trending()
252
+ return res.json({ result })
253
+ } else if (/^stalk$/i.test(req.params.type)) {
254
+ if (!req.query.user) return res.json({ message: 'Required an username' })
255
+ let result = await urlebird.user(req.query.user)
256
+ await fss.writeFile('sektedoujin.json', JSON.stringify(result, null, 2));
257
+ return res.json({ result })
258
+ } else if (/^detail$/i.test(req.params.type)) {
259
+ if (!req.query.url) return res.json({ message: 'Required an url' })
260
+ let result = await urlebird.detailVideo(req.query.url)
261
+ return res.json({ result })
262
+ }
263
+ } catch (e) {
264
+ res.send(e)
265
+ }
266
+ })
267
+
268
  app.all('/mediafire', async (req, res) => {
269
  if (!['GET', 'POST'].includes(req.method))
270
  return res