const express = require('express'); const morgan = require('morgan') const { pin, tiktokDl, vocAi, ttp, attp, Carbon, quaxx, pixeldraiin, ttsEmma, facebook, googleSearch, googleImage, generateImage, generateWithDallEXL, generateWithSDXL, generateWithPixArt_Sigma, youtube, youtubev2, simi, upscale, cobalt, instagram, teradl } = require('./scrape') const cai = require('./scrape/cai') const { generateMeme } = require('./meme/meme') const { upfile, isUrl, getBuffer, base64ToBuffer, getMimeType } = require('./lib/function') const { otakudesu, samehadaku, mynimeku, oploverz } = require("./lib/anime/index"); let creator = 'Mroy25' const app = express() .set('json spaces', 4) .use(morgan('dev')) .use(express.json()) .all('/', (_, res) => { let baseUrl = `https://${_.get('host')}` res.json({ author: `Mroy25`, WA: `081215524272`, runtime: new Date(process.uptime() * 1000).toTimeString().split(' ')[0], endpoint: { ai: { cai_chat: `${baseUrl}/cai-chat?characterid=&text=&sessionid=`, cai_info: `${baseUrl}/cai-info?characterid=`, cai_search: `${baseUrl}/cai-search?name=gojou`, vocai: `${baseUrl}/vocai?prompt=whats+is+ai`, diffusion_anime: `${baseUrl}/diffusion-anime?prompt=anime+girl+with+cat+ears`, diffusion_dalle: `${baseUrl}/diffusion-dalle?prompt=a+beautiful+woman`, diffusion_flux: `${baseUrl}/diffusion-flux?prompt=a+beautiful+woman`, }, anime: { otakudesu_detail: `${baseUrl}/otakudesu-detail?url=YOUR-URL`, otakudesu_download: `${baseUrl}/otakudesu-download?url=YOUR-URL`, otakudesu_latest: `${baseUrl}/otakudesu-latest?page=1`, otakudesu_search: `${baseUrl}/otakudesu-search?anime=one+piece`, samehadaku_batch: `${baseUrl}/samehadaku-batch?url=YOUR-URL`, samehadaku_detail: `${baseUrl}/samehadaku-detail?url=YOUR-URL`, samehadaku_download: `${baseUrl}/samehadaku-download?url=YOUR-URL`, samehadaku_latest: `${baseUrl}/samehadaku-latest?page=1`, samehadaku_search: `${baseUrl}/samehadaku-search?name=one+piece`, }, media_downloader: { cobalt: `${baseUrl}/cobalt?url=YOUR-URL`, facebook: `${baseUrl}/facebook?url=YOUR-URL`, googleimage: `${baseUrl}/googleimage?query=kucing`, googlesearch: `${baseUrl}/googlesearch?query=kucing`, instagram: `${baseUrl}/instagram?url=YOUR-URL`, pinterest_search: `${baseUrl}/pinterest-search?query=anime`, pinterest_download: `${baseUrl}/pinterest-download?url=YOUR-URL`, terabox: `${baseUrl}/terabox?url=YOUR-URL`, tiktok: `${baseUrl}/tiktok?url=YOUR-URL`, twitter: `${baseUrl}/twitter?url=YOUR-URL`, youtube: `${baseUrl}/youtube?query=sayang`, }, tools: { attp: `${baseUrl}/attp?query=TRASH`, ttp: `${baseUrl}/ttp?query=TRASH`, carbon: `${baseUrl}/carbon?code=hello+world`, memegenerator: `${baseUrl}/memegenerator?url=YOUR-IMAGE-URL&atas=text+atas&bawah=text+bawah`, mimetype: `${baseUrl}/mimetype?ext=jpg`, simi: `${baseUrl}/simi?query=hai+simi&lang=id`, tts: `${baseUrl}/tts?query=hello+world&lang=id-ID`, upscale: `${baseUrl}/upscale?url=YOUR-URL`, }, others: { pixeldraiin: `${baseUrl}/pixeldraiin?page=1`, quaxx: `${baseUrl}/quaxx?page=1`, } }, }) }) //------------------< ANIME >------------------- .get('/otakudesu-search', async (req, res) => { let q = req.query.anime if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter anime' }) try { let otaku = await otakudesu.Search(q) if(otaku.status === false) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: otaku.result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/otakudesu-latest', async (req, res) => { let q = req.query.page if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter page' }) let page = q ? q : '1' try { let otaku = await otakudesu.Ongoing(page) if(otaku.status === false) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: otaku.result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/otakudesu-detail', async (req, res) => { let q = req.query.url if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter url' }) if(!isUrl(q) && !q.includes('otakudesu')) return res.json({ status: false, creator: `${creator}`, message: 'Url tidak valid' }) try { let otaku = await otakudesu.animeDetail(q) console.log(otaku) if(otaku.status === false) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: otaku.result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/otakudesu-download', async (req, res) => { let q = req.query.url if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter url' }) if(!isUrl(q) && !q.includes('otakudesu')) return res.json({ status: false, creator: `${creator}`, message: 'Url tidak valid' }) try { let otaku = await otakudesu.animeDl(q) console.log(otaku) if(otaku.status === false) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: otaku.result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/samehadaku-search', async (req, res) => { let q = req.query.anime if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter anime' }) try { let same = await samehadaku.searchAnime(q) if(same.status === false) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) let result = same.anime_list res.json({ status: true, creator: `${creator}`, result: result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/samehadaku-latest', async (req, res) => { let q = req.query.page if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter page' }) let page = q ? q : '1' try { let same = await samehadaku.ongoingAnime(page) if(same.status === false) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) let result = same.anime_list res.json({ status: true, creator: `${creator}`, result: result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/samehadaku-batch', async (req, res) => { let q = req.query.url if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter url' }) if(!isUrl(q) && !q.includes('samehadaku') && !q.includes('batch')) return res.json({ status: false, creator: `${creator}`, message: 'Url tidak valid' }) try { let result = await samehadaku.detailBatch(q) if(result.status === false) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/samehadaku-detail', async (req, res) => { let q = req.query.url if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter url' }) if(!isUrl(q) && !q.includes('samehadaku')) return res.json({ status: false, creator: `${creator}`, message: 'Url tidak valid' }) try { let result = await samehadaku.detailAnime(q) if(result.status === false) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/samehadaku-download', async (req, res) => { let q = req.query.url if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter url' }) if(!isUrl(q) && !q.includes('samehadaku')) return res.json({ status: false, creator: `${creator}`, message: 'Url tidak valid' }) try { let result = await samehadaku.showEpisode(q) if(result.status === false) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) //------------------< AI >------------------- .get('/vocai', async (req, res) => { let q = req.query.prompt if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter prompt' }) try { const result = await vocAi(q); if(result.status === false) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: result.result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/diffusion-anime', async (req, res) => { let q = req.query.prompt if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter prompt' }) try { const result = await generateImage(q, "square", "Anime 2"); if(!result.status === true) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: result.images }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/diffusion-flux', async (req, res) => { let q = req.query.prompt if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter prompt' }) try { const result = await generateImage(q, "square", "FLUX.1 [schnell]"); if(!result.status === true) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: result.images }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/diffusion-dalle', async (req, res) => { let q = req.query.prompt if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter prompt' }) try { const result = await generateImage(q, "square", "DallE-XL"); if(!result.status === true) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: result.images }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/cai-info', async (req, res) => { let q = req.query.characterid if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter characterid' }) try { const result = await cai.caiInfo(q); if(result.status === false) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: result.result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/cai-search', async (req, res) => { let q = req.query.name if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter name' }) try { const result = await cai.caiSearch(q); if(result.status === false) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: result.result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/cai-chat', async (req, res) => { let id = req.query.characterid let text = req.query.text let sid = req.query.sessionid if (!id) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter characterid' }) if (!text) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter text' }) if (!sid) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter sessionid' }) try { const result = await cai.caiChat(id, text, sid); if(result.status === false) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: result.result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) //------------------< MEDIA & DOWNLOADER >------------------- .get('/pinterest-search', async (req, res) => { let q = req.query.query if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter query' }) try { const result = await pin.Search(q); if(!result) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/pinterest-download', async (req, res) => { let q = req.query.url if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter url' }) if(!isUrl(q) && !q.includes('pin')) return res.json({ status: false, creator: `${creator}`, message: 'Url tidak valid' }) try { const result = await pin.Download(q); if(!result) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/cobalt', async (req, res) => { let q = req.query.url if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter url' }) if(!isUrl(q)) return res.json({ status: false, creator: `${creator}`, message: 'Url tidak valid' }) try { const result = await cobalt(q); if(result.status === false) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: result.result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/facebook', async (req, res) => { let q = req.query.url if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter url' }) if(!isUrl(q)) return res.json({ status: false, creator: `${creator}`, message: 'Url tidak valid' }) try { const result = await facebook(q); if(!result) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: result.data }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/terabox', async (req, res) => { let q = req.query.url if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter url' }) if(!isUrl(q)) return res.json({ status: false, creator: `${creator}`, message: 'Url tidak valid' }) try { const result = await teradl(q); if(!result) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/instagram', async (req, res) => { let q = req.query.url if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter url' }) if(!isUrl(q) && !q.includes('instagram')) return res.json({ status: false, creator: `${creator}`, message: 'Url tidak valid' }) try { const result = await instagram(q); if(result.status === false) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: result.result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/tiktok', async (req, res) => { let q = req.query.url if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter url' }) if(!isUrl(q) && !q.includes('tiktok')) return res.json({ status: false, creator: `${creator}`, message: 'Url tidak valid' }) try { const result = await tiktokDl(q); if(!result) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/twitter', async (req, res) => { let q = req.query.url if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter url' }) if(!isUrl(q) && !q.includes('twitter.com')) return res.json({ status: false, creator: `${creator}`, message: 'Url tidak valid' }) try { const parse = q.split('/status/')[1] const result = await axios.get(`https://api.vxtwitter.com/Twitter/status/` + parse); if(!result.data) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: result.data }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/googlesearch', async (req, res) => { let q = req.query.query if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter query' }) try { let google = new googleSearch const result = await google.search(q); if(!result) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/googleimage', async (req, res) => { let q = req.query.query if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter query' }) try { const result = await googleImage(q); if(!result) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/youtube', async (req, res) => { let q = req.query.query if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter query' }) try { const result = await youtube(q); if(!result) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/youtubev2', async (req, res) => { let q = req.query.query if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter query' }) try { const result = await youtubev2(q); if(!result) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) //------------------< TOOLS >------------------- .get('/tts', async (req, res) => { let q = req.query.query let p = req.query.lang if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter query' }) if (!p) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter lang' }) try { const result = await ttsEmma(q, p); if(!result) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.setHeader('Content-Type', 'audio/mp3'); res.send(result) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/carbon', async (req, res) => { let q = req.query.code if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter code' }) try { await Carbon(q).then((result) =>{ res.json({ status: true, creator: `${creator}`, result }) }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/ttp', async (req, res) => { let q = req.query.query if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter query' }) try { await ttp(q).then(async(buffer) =>{ let result = await upfile(buffer) res.json({ status: true, creator: `${creator}`, result: result.url }) }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/attp', async (req, res) => { let q = req.query.query if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter query' }) try { await attp(q).then(async(buffer) =>{ let result = await upfile(buffer) res.json({ status: true, creator: `${creator}`, result: result.url }) }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/memegenerator', async (req, res) => { let url = req.query.url let atas = req.query.atas let bawah = req.query.bawah if(!isUrl(url)) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter url image' }) if (!atas) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter atas' }) if (!bawah) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter bawah' }) try { let img = await getBuffer(url) await generateMeme(img, atas, bawah).then(async(buffer) =>{ let result = await upfile(buffer) res.json({ status: true, creator: `${creator}`, result: result.url }) }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/simi', async (req, res) => { let q = req.query.query let p = req.query.lang if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter query' }) if (!p) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter lang' }) try { const result = await simi(q, p); if(!result.status === true) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result: result.message }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/upscale', async (req, res) => { let q = req.query.url if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter url' }) if(!isUrl(q)) return res.json({ status: false, creator: `${creator}`, message: 'Url tidak valid' }) try { const buffer = await getBuffer(q) const result = await upscale(buffer, 'enhance'); if(!result) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/mimetype', async (req, res) => { let q = req.query.ext if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter ext' }) try { const result = await getMimeType(q); if(!result) return res.json({ status: false, creator: `${creator}`, message: 'mimetype not found' }) res.json({ status: true, creator: `${creator}`, result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) //------------------< OTHER >------------------- .get('/quaxx', async (req, res) => { let q = req.query.page if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter page' }) try { const result = await quaxx(q); if(!result) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .get('/pixeldraiin', async (req, res) => { let q = req.query.page if (!q) return res.json({ status: false, creator: `${creator}`, message: 'Input parameter page' }) try { const result = await pixeldraiin(q); if(!result) return res.json({ status: false, creator: `${creator}`, message: 'Error to fetch data' }) res.json({ status: true, creator: `${creator}`, result }) } catch (err) { res.json({ status: false, creator: `${creator}`, message: err }) } }) .listen(7860, () => console.log('App running on port 7860'))