mywork / davidcyriltech /scraperrr.js
DeeCeeXxx's picture
Upload 199 files
6c07b9a verified
const { modul } = require('../module');
const { axios, cheerio, fs, fetch, got, util, yts, ytdl } = modul;
function niatsholat (qurerryy) {
return new Promise( async (resolve, reject) => {
const scraper = JSON.parse(fs.readFileSync(`./database/niatSholat/${qurerryy}.json`))
console.log(scraper)
const result = {
name: scraper.name,
arabic: scraper.arabic,
latin: scraper.latin,
terjemahan: scraper.terjemahan
}
resolve(result)
}).catch((err) => {resolve(err) })
}
function asmaulhusna() {
var rndm = ['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']
var bykir = rndm[Math.floor(Math.random() * rndm.length)]
return new Promise( async (resolve, reject) => {
const scraper = JSON.parse(fs.readFileSync(`./database/asmaulHusna/${bykir}.json`))
console.log(scraper)
const result = {
nomor: scraper.number,
latin: scraper.latin,
arabic: scraper.arab,
id: scraper.translate_id,
en: scraper.translate_en
}
resolve(result)
}).catch((err) => {resolve(err) })
}
function bacaanshalat () {
var rndom = ['1','2','3','4','5','6','7','8']
var bykire = rndom[Math.floor(Math.random() * rndm.length)]
return new Promise( async (resolve, reject) => {
const scraper = JSON.parse(fs.readFileSync(`./database/bacaanSholat/${bykire}.json`))
console.log(scraper)
const result = {
nomor: scraper.no,
name: scraper.name,
arabic: scraper.arabic,
latin: scraper.latin,
terjemahan: scraper.terjemahan
}
resolve(result)
}).catch((err) => {resolve(err) })
}
function getDoujin(identifier) {
const id = identifier.replace(urlToId, '$2');
return new Promise((resolve, reject) => {
request
.get('https://nhentai.net/g/' + id + '/')
.then(res => {
const $ = cheerio.load(res.text);
let details = {};
$('.tag-container.field-name').find('.count').each(function () {
const el = $(this);
el.text(` (${el.text()}) `);
});
$('.tag-container.field-name').text().split('\n').map(string => string.trim()).filter(u => u).map((tag, i, tags) => {
if (tag.endsWith(':') && !tags[i + 1].endsWith(':')) {
details[tag.substring(0, tag.length - 1).toLowerCase()] = tags[i + 1].replace(tagSpacerPatternn, '$1 $2').split(tagSplitPattern);
}
});
const title = $('#info').find('h1').text();
const nativeTitle = $('#info').find('h2').text();
const thumbnails = Object.entries($('.gallerythumb').find('img')).map(image => {
return image[1].attribs
? image[1].attribs['data-src']
: null;
}).filter(link => link);
const images = Object.entries($('.gallerythumb').find('img')).map(image => {
return image[1].attribs
? image[1].attribs['data-src'].replace(/t(\.(jpg|png|gif))/, '$1').replace('t.nhentai', 'i.nhentai')
: null;
}).filter(link => link);
const link = `https://nhentai.net/g/${id}/`;
resolve({ title, nativeTitle, details, pages: images, thumbnails, link });
})
.catch(reject);
});
}
function onGoing() {
return new Promise((resolve, reject) => {
axios.get('https://neonime.co/episode/').then(res => {
const $ = cheerio.load(res.data)
const result = []
$('tbody').find('tr').each(function(a, b) {
const link = $(b).find('td > div.imagen-td > a').attr('href')
const img = $(b).find('td > div.imagen-td > a > img').attr('data-src')
const info = $(b).find('td.bb > a > span').text().trim()
const judul = $(b).find('td.bb > a').text()
const tgl_rilis = $(b).find('td.dd').text()
result.push({ judul, link, img, info, tgl_rilis })
})
resolve(result)
}).catch(reject)
})
}
function kusoNime(query) {
return new Promise(async (resolve, reject) => {
const optionsGet = {
method: 'GET',
headers: {
'user-agent': 'Mozilla/5.0 (Linux; Android 9; Redmi 7A) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.99 Mobile Safari/537.36'
}
}
const getHtml = await fetch('https://kusonime.com/?s=' + query + '&post_type=anime', optionsGet).then(rsp => rsp.text())
const $ = cheerio.load(getHtml)
const url = []
$('div > div > ul > div > div > div').each(function() {
url.push($(this).find('a').attr('href'))
})
const randomUrl = url[Math.floor(Math.random() * url.length)]
const getHtml2 = await fetch(randomUrl, optionsGet).then(rsp => rsp.text())
const $$ = cheerio.load(getHtml2)
resolve({
status: 200,
result: {
title: $$('.vezone > .venser').find('.jdlz').text(),
thumb: $$('.vezone > .venser').find('div > img').attr('src'),
views: $$('.vezone > .venser').find('div > div > span').text().trim().replace(' Views', ''),
genre: $$('.vezone > .venser').find('.lexot > .info > p').eq(1).text().replace('Genre : ', ''),
seasons: $$('.vezone > .venser').find('.lexot > .info > p').eq(2).text().replace('Seasons : ', ''),
producers: $$('.vezone > .venser').find('.lexot > .info > p').eq(3).text().replace('Producers: ', ''),
type: $$('.vezone > .venser').find('.lexot > .info > p').eq(4).text().replace('Type: ', ''),
status: $$('.vezone > .venser').find('.lexot > .info > p').eq(5).text().replace('Status: ', ''),
rating: $$('.vezone > .venser').find('.lexot > .info > p').eq(7).text().replace('Score: ', ''),
duration: $$('.vezone > .venser').find('.lexot > .info > p').eq(8).text().replace('Duration: ', ''),
release: $$('.vezone > .venser').find('.lexot > .info > p').eq(9).text().replace('Released on: ', ''),
desc: $$('.vezone > .venser').find('p').eq(10).text(),
url: randomUrl
}
})
})
}
async function mlstalk(id, zoneId) {
return new Promise(async (resolve, reject) => {
axios
.post(
'https://api.duniagames.co.id/api/transaction/v1/top-up/inquiry/store',
new URLSearchParams(
Object.entries({
productId: '1',
itemId: '2',
catalogId: '57',
paymentId: '352',
gameId: id,
zoneId: zoneId,
product_ref: 'REG',
product_ref_denom: 'AE',
})
),
{
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
Referer: 'https://www.duniagames.co.id/',
Accept: 'application/json',
},
}
)
.then((response) => {
resolve(response.data.data.gameDetail)
})
.catch((err) => {
reject(err)
})
})
}
async function ffstalk(userId) {
let data = {
"voucherPricePoint.id": 8050,
"voucherPricePoint.price": "",
"voucherPricePoint.variablePrice": "",
"email": "",
"n": "",
"userVariablePrice": "",
"order.data.profile": "",
"user.userId": userId,
"voucherTypeName": "FREEFIRE",
"affiliateTrackingId": "",
"impactClickId": "",
"checkoutId": "",
"tmwAccessToken": "",
"shopLang": "in_ID",
}
let ff = await axios({
"headers": {
"Content-Type": "application/json; charset\u003dutf-8"
},
"method": "POST",
"url": "https://order.codashop.com/id/initPayment.action",
"data": data
})
return {
id: userId,
nickname: ff.data["confirmationFields"]["roles"][0]["role"]
}
}
async function npmstalk(packageName) {
let stalk = await axios.get("https://registry.npmjs.org/"+packageName)
let versions = stalk.data.versions
let allver = Object.keys(versions)
let verLatest = allver[allver.length-1]
let verPublish = allver[0]
let packageLatest = versions[verLatest]
return {
name: packageName,
versionLatest: verLatest,
versionPublish: verPublish,
versionUpdate: allver.length,
latestDependencies: Object.keys(packageLatest.dependencies).length,
publishDependencies: Object.keys(versions[verPublish].dependencies).length,
publishTime: stalk.data.time.created,
latestPublishTime: stalk.data.time[verLatest]
}
}
function quotesanime() {
return new Promise((resolve, reject) => {
const page = Math.floor(Math.random() * 184)
axios.get('https://otakotaku.com/quote/feed/'+page)
.then(({ data }) => {
const $ = cheerio.load(data)
const hasil = []
$('div.kotodama-list').each(function(l, h) {
hasil.push({
link: $(h).find('a').attr('href'),
gambar: $(h).find('img').attr('data-src'),
karakter: $(h).find('div.char-name').text().trim(),
anime: $(h).find('div.anime-title').text().trim(),
episode: $(h).find('div.meta').text(),
up_at: $(h).find('small.meta').text(),
quotes: $(h).find('div.quote').text().trim()
})
})
resolve(hasil)
}).catch(reject)
})
}
function pornovid() {
return new Promise((resolve, reject) => {
axios.get('https://tikporntok.com/?random=1')
.then((res) => {
const $ = cheerio.load(res.data)
const hasil = {}
hasil.title = $('article > h1').text()
hasil.source = $('article > div.video-wrapper.vxplayer').attr('data-post') || 'Web Not Response'
hasil.thumb = $('article > div.video-wrapper.vxplayer > div.vx_el').attr('data-poster') || 'https://4.bp.blogspot.com/-hyMqjmQQq4o/W6al-Rk4IpI/AAAAAAAADJ4/m-lVBA_GC9Q5d4BIQg8ZO3fYmQQC3LqSACLcBGAs/s1600/404_not_found.png'
hasil.desc = $('article > div.intro').text()
hasil.upload = $('article > div.single-pre-meta.ws.clearfix > time').text()
hasil.like = $('article > div.single-pre-meta.ws.clearfix > div > span:nth-child(1) > span').text()
hasil.dislike = $('article > div.single-pre-meta.ws.clearfix > div > span:nth-child(2) > span').text()
hasil.favorite = $('article > div.single-pre-meta.ws.clearfix > div > span:nth-child(3) > span').text()
hasil.views = $('article > div.single-pre-meta.ws.clearfix > div > span:nth-child(4) > span').text()
hasil.tags = $('article > div.post-tags').text()
hasil.video = $('article > div.video-wrapper.vxplayer > div.vx_el').attr('src') || $('article > div.video-wrapper.vxplayer > div.vx_el').attr('data-src') || 'https://4.bp.blogspot.com/-hyMqjmQQq4o/W6al-Rk4IpI/AAAAAAAADJ4/m-lVBA_GC9Q5d4BIQg8ZO3fYmQQC3LqSACLcBGAs/s1600/404_not_found.png'
resolve(hasil)
})
})
}
function hentaivid() {
return new Promise((resolve, reject) => {
const page = Math.floor(Math.random() * 1153)
axios.get('https://sfmcompile.club/page/'+page)
.then((data) => {
const $ = cheerio.load(data.data)
const hasil = []
$('#primary > div > div > ul > li > article').each(function (a, b) {
hasil.push({
title: $(b).find('header > h2').text(),
link: $(b).find('header > h2 > a').attr('href'),
category: $(b).find('header > div.entry-before-title > span > span').text().replace('in ', ''),
share_count: $(b).find('header > div.entry-after-title > p > span.entry-shares').text(),
views_count: $(b).find('header > div.entry-after-title > p > span.entry-views').text(),
type: $(b).find('source').attr('type') || 'image/jpeg',
video_1: $(b).find('source').attr('src') || $(b).find('img').attr('data-src'),
video_2: $(b).find('video > a').attr('href') || ''
})
})
resolve(hasil)
})
})
}
function nomorhp(nomor) {
return new Promise((resolve, reject) => {
axios({
headers: {
type: 'application/x-www-form-urlencoded'
},
method: 'POST',
url: 'https://www.primbon.com/no_hoki_bagua_shuzi.php',
data: new URLSearchParams(Object.entries({
nomer: nomor,
submit: 'Submit!'
}))
}).then(({data}) => {
let $ = cheerio.load(data)
let fetchText = $('#body').text().trim()
let result;
try {
result = {
nomor_hp: fetchText.split('No. HP : ')[1].split('\n')[0],
angka_bagua_shuzi: fetchText.split('Angka Bagua Shuzi : ')[1].split('\n')[0],
energi_positif: {
kekayaan: fetchText.split('Kekayaan = ')[1].split('\n')[0],
kesehatan: fetchText.split('Kesehatan = ')[1].split('\n')[0],
cinta: fetchText.split('Cinta/Relasi = ')[1].split('\n')[0],
kestabilan: fetchText.split('Kestabilan = ')[1].split('\n')[0],
persentase: fetchText.split('Kestabilan = ')[1].split('% = ')[1].split('ENERGI NEGATIF')[0]
},
energi_negatif: {
perselisihan: fetchText.split('Perselisihan = ')[1].split('\n')[0],
kehilangan: fetchText.split('Kehilangan = ')[1].split('\n')[0],
malapetaka: fetchText.split('Malapetaka = ')[1].split('\n')[0],
kehancuran: fetchText.split('Kehancuran = ')[1].split('\n')[0],
persentase: fetchText.split('Kehancuran = ')[1].split('% = ')[1].split("\n")[0]
},
notes: fetchText.split('* ')[1].split('Masukan Nomor HP Anda')[0]
}
} catch {
result = `Nomor "${nomor}" tidak valid`
}
resolve(result)
}).catch(reject)
})
}
function character(query) {
return new Promise((resolve, reject) => {
axios.get(`https://www.anime-planet.com/characters/all?name=${query}`)
.then(({
data
}) => {
const hasil = []
const $ = cheerio.load(data)
$('#siteContainer > table > tbody > tr').each(function (a, b) {
result = {
status: 200,
author: 'KirBotz',
character: $(b).find('> td.tableCharInfo > a').text(),
link: 'https://www.anime-planet.com' + $(b).find('> td.tableCharInfo > a').attr('href'),
thumbnail: $(b).find('> td.tableAvatar > a > img').attr('src').startsWith('https://') ? $(b).find('> td.tableAvatar > a > img').attr('src') : 'https://www.anime.planet.com' + $(b).find('> td.tableAvatar > a > img').attr('src')
};
hasil.push(result);
});
resolve(hasil)
})
.catch(reject)
})
}
function anime(query) {
return new Promise((resolve, reject) => {
axios.get(`https://www.anime-planet.com/anime/all?name=${query}`)
.then(({
data
}) => {
const hasil = []
const $ = cheerio.load(data)
$('#siteContainer > ul.cardDeck.cardGrid > li ').each(function (a, b) {
result = {
status: 200,
author: 'KirBotz',
judul: $(b).find('> a > h3').text(),
link: 'https://www.anime-planet.com' + $(b).find('> a').attr('href'),
thumbnail: 'https://www.anime-planet.com' + $(b).find('> a > div.crop > img').attr('src')
};
hasil.push(result);
});
resolve(hasil)
})
.catch(reject)
})
}
function manga(query) {
return new Promise((resolve, reject) => {
axios.get(`https://www.anime-planet.com/manga/all?name=${query}`)
.then(({
data
}) => {
const hasil = []
const $ = cheerio.load(data)
$('#siteContainer > ul.cardDeck.cardGrid > li ').each(function (a, b) {
result = {
status: 200,
author: 'KirBotz',
judul: $(b).find('> a > h3').text(),
link: 'https://www.anime-planet.com' + $(b).find('> a').attr('href'),
thumbnail: 'https://www.anime-planet.com' + $(b).find('> a > div.crop > img').attr('src')
};
hasil.push(result);
});
resolve(hasil)
})
.catch(reject)
})
}
function searchsticker(queryy) {
return new Promise((resolve, reject) => {
axios.get(`https://getstickerpack.com/stickers?query=${queryy}`)
.then(({data}) => {
const $ = cheerio.load(data)
const source = []
const linknya = []
$('#stickerPacks > div > div:nth-child(3) > div > a').each((a, b) => {
source.push($(b).attr('href'))
})
axios.get(source[Math.floor(Math.random() * source.length)])
.then(({data}) => {
const $2 = cheerio.load(data)
$2('#stickerPack > div > div.row > div > img').each((c, d) => {
linknya.push($2(d).attr('src').replace(/&d=200x200/g, ''))
})
result = {
title: $2('#intro > div > div > h1').text(),
stickerUrl: linknya
}
resolve(result)
})
}).catch(reject)
})
}
function igstalk(Username) {
return new Promise((resolve, reject) => {
axios.get('https://dumpor.com/v/'+Username, {
headers: {
"cookie": "_inst_key=SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYWGhnNS1uWVNLUU81V1lzQ01MTVY2R0h1.fI2xB2dYYxmWqn7kyCKIn1baWw3b-f7QvGDfDK2WXr8",
"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
}
}).then(res => {
const $ = cheerio.load(res.data)
const result = {
profile: $('#user-page > div.user > div.row > div > div.user__img').attr('style').replace(/(background-image: url\(\'|\'\);)/gi, ''),
fullname: $('#user-page > div.user > div > div.col-md-4.col-8.my-3 > div > a > h1').text(),
username: $('#user-page > div.user > div > div.col-md-4.col-8.my-3 > div > h4').text(),
post: $('#user-page > div.user > div > div.col-md-4.col-8.my-3 > ul > li:nth-child(1)').text().replace(' Posts',''),
followers: $('#user-page > div.user > div > div.col-md-4.col-8.my-3 > ul > li:nth-child(2)').text().replace(' Followers',''),
following: $('#user-page > div.user > div > div.col-md-4.col-8.my-3 > ul > li:nth-child(3)').text().replace(' Following',''),
bio: $('#user-page > div.user > div > div.col-md-5.my-3 > div').text()
}
resolve(result)
})
})
}
function listsurah() {
return new Promise((resolve, reject) => {
axios.get('https://litequran.net/')
.then(({ data }) => {
const $ = cheerio.load(data)
let listsurah = []
$('body > main > section > ol > li > a').each(function(a, b) {
listsurah.push($(b).text())
})
result = {
status: 200,
author: 'KirBotz',
listsurah: listsurah
}
resolve(result)
}).catch(reject)
})
}
function jadwalsholat(query) {
return new Promise((resolve, reject) => {
axios.get(`https://umrotix.com/jadwal-sholat/${query}`)
.then(({
data
}) => {
const $ = cheerio.load(data)
$('body > div > div.main-wrapper.scrollspy-action > div:nth-child(3) ').each(function(a, b) {
result = {
status: 200,
author: 'KirBotz',
tanggal: $(b).find('> div:nth-child(2)').text(),
imsyak: $(b).find('> div.panel.daily > div > div > div > div > div:nth-child(1) > p:nth-child(2)').text(),
subuh: $(b).find('> div.panel.daily > div > div > div > div > div:nth-child(2) > p:nth-child(2)').text(),
dzuhur: $(b).find('> div.panel.daily > div > div > div > div > div:nth-child(3) > p:nth-child(2)').text(),
ashar: $(b).find('> div.panel.daily > div > div > div > div > div:nth-child(4) > p:nth-child(2)').text(),
maghrib: $(b).find('> div.panel.daily > div > div > div > div > div:nth-child(5) > p:nth-child(2)').text(),
isya: $(b).find('> div.panel.daily > div > div > div > div > div:nth-child(6) > p:nth-child(2)').text()
}
resolve(result)
})
})
.catch(reject)
})
}
async function telesticker(url){
return new Promise(async (resolve, reject) => {
packName = url.replace("https://t.me/addstickers/", "")
data = await axios(`https://api.telegram.org/bot891038791:AAHWB1dQd-vi0IbH2NjKYUk-hqQ8rQuzPD4/getStickerSet?name=${encodeURIComponent(packName)}`, {method: "GET",headers: {"User-Agent": "GoogleBot"}})
const hasil = []
for (let i = 0; i < data.data.result.stickers.length; i++) {
fileId = data.data.result.stickers[i].thumb.file_id
data2 = await axios(`https://api.telegram.org/bot891038791:AAHWB1dQd-vi0IbH2NjKYUk-hqQ8rQuzPD4/getFile?file_id=${fileId}`)
result = {
url: "https://api.telegram.org/file/bot891038791:AAHWB1dQd-vi0IbH2NjKYUk-hqQ8rQuzPD4/" + data2.data.result.file_path
}
hasil.push(result.url)
}
resolve(hasil)
})
}
async function aiovideodl(url) {
let { data, headers } = await axios("https://aiovideodl.ml/");
let $ = cheerio.load(data);
let token = $("#token").attr("value");
let cookie = headers["set-cookie"].join("; ");
let body = new URLSearchParams({ url, token });
let { data: res } = await axios({
"url": "https://aiovideodl.ml/wp-json/aio-dl/video-data/",
"method": "POST",
"data": body,
"headers": {
"content-type": "application/x-www-form-urlencoded",
"cookie": cookie,
"origin": "https://aiovideodl.ml",
"referer": "https://aiovideodl.ml/",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36"
}
});
return res;
}
function linkwa(nama){
return new Promise((resolve,reject) => {
axios.get('http://ngarang.com/link-grup-wa/daftar-link-grup-wa.php?search='+ nama +'&searchby=name')
.then(({ data }) => {
const $ = cheerio.load(data);
const result = [];
const lnk = [];
const nm = [];
$('div.wa-chat-title-container').each(function(a,b){
const limk = $(b).find('a').attr('href');
lnk.push(limk)
})
$('div.wa-chat-title-text').each(function(c,d) {
const name = $(d).text();
nm.push(name)
})
for( let i = 0; i < lnk.length; i++){
result.push({
nama: nm[i].split('. ')[1],
link: lnk[i].split('?')[0]
})
}
resolve(result)
})
.catch(reject)
})
}
async function mediafiredl(url) {
var _a, _b;
if (!/https?:\/\/(www\.)?mediafire\.com/.test(url))
throw new Error('Invalid URL: ' + url);
const data = await got(url).text();
const $ = cheerio.load(data);
const Url = ($('#downloadButton').attr('href') || '').trim();
const url2 = ($('#download_link > a.retry').attr('href') || '').trim();
const $intro = $('div.dl-info > div.intro');
const filename = $intro.find('div.filename').text().trim();
const filetype = $intro.find('div.filetype > span').eq(0).text().trim();
const ext = ((_b = (_a = /\(\.(.*?)\)/.exec($intro.find('div.filetype > span').eq(1).text())) === null || _a === void 0 ? void 0 : _a[1]) === null || _b === void 0 ? void 0 : _b.trim()) || 'bin';
const $li = $('div.dl-info > ul.details > li');
const aploud = $li.eq(1).find('span').text().trim();
const filesizeH = $li.eq(0).find('span').text().trim();
const filesize = parseFloat(filesizeH) * (/GB/i.test(filesizeH)
? 1000000
: /MB/i.test(filesizeH)
? 1000
: /KB/i.test(filesizeH)
? 1
: /B/i.test(filesizeH)
? 0.1
: 0);
return {
url: Url,
url2,
filename,
filetype,
ext,
aploud,
filesizeH,
filesize
};
}
async function ytPlayMp4(query) {
return new Promise((resolve, reject) => {
try {
const search = yts(query)
.then((data) => {
const url = []
const pormat = data.all
for (let i = 0; i < pormat.length; i++) {
if (pormat[i].type == 'video') {
let dapet = pormat[i]
url.push(dapet.url)
}
}
const id = ytdl.getVideoID(url[0])
const yutub = ytdl.getInfo(`https://www.youtube.com/watch?v=${id}`)
.then((data) => {
let pormat = data.formats
let video = []
for (let i = 0; i < pormat.length; i++) {
if (pormat[i].container == 'mp4' && pormat[i].hasVideo == true && pormat[i].hasAudio == true) {
let vid = pormat[i]
video.push(vid.url)
}
}
const title = data.player_response.microformat.playerMicroformatRenderer.title.simpleText
const thumb = data.player_response.microformat.playerMicroformatRenderer.thumbnail.thumbnails[0].url
const channel = data.player_response.microformat.playerMicroformatRenderer.ownerChannelName
const views = data.player_response.microformat.playerMicroformatRenderer.viewCount
const published = data.player_response.microformat.playerMicroformatRenderer.publishDate
const result = {
title: title,
thumb: thumb,
channel: channel,
published: published,
views: views,
url: video[0]
}
return(result)
})
return(yutub)
})
resolve(search)
} catch (error) {
reject(error)
}
console.log(error)
})
}
async function ytPlayMp3(query) {
return new Promise((resolve, reject) => {
try {
const search = yts(query)
.then((data) => {
const url = []
const pormat = data.all
for (let i = 0; i < pormat.length; i++) {
if (pormat[i].type == 'video') {
let dapet = pormat[i]
url.push(dapet.url)
}
}
const id = ytdl.getVideoID(url[0])
const yutub = ytdl.getInfo(`https://www.youtube.com/watch?v=${id}`)
.then((data) => {
let pormat = data.formats
let audio = []
let video = []
for (let i = 0; i < pormat.length; i++) {
if (pormat[i].mimeType == 'audio/webm; codecs=\"opus\"') {
let aud = pormat[i]
audio.push(aud.url)
}
}
const title = data.player_response.microformat.playerMicroformatRenderer.title.simpleText
const thumb = data.player_response.microformat.playerMicroformatRenderer.thumbnail.thumbnails[0].url
const channel = data.player_response.microformat.playerMicroformatRenderer.ownerChannelName
const views = data.player_response.microformat.playerMicroformatRenderer.viewCount
const published = data.player_response.microformat.playerMicroformatRenderer.publishDate
const result = {
status: true,
code: 200,
creator: '@kirbotz×',
title: title,
thumb: thumb,
channel: channel,
published: published,
views: views,
url: audio[0]
}
return(result)
})
return(yutub)
})
resolve(search)
} catch (error) {
reject(error)
}
console.log(error)
})
}
function cerpen (category) {
return new Promise(async (resolve, reject) => {
let title = category.toLowerCase().replace(/[()*]/g, "")
let judul = title.replace(/\s/g, "-")
let page = Math.floor(Math.random() * 5)
axios.get('http://cerpenmu.com/category/cerpen-'+judul+'/page/'+page)
.then((get) => {
let $ = cheerio.load(get.data)
let link = []
$('article.post').each(function (a, b) {
link.push($(b).find('a').attr('href'))
})
let random = link[Math.floor(Math.random() * link.length)]
axios.get(random)
.then((res) => {
let $$ = cheerio.load(res.data)
let hasil = {
title: $$('#content > article > h1').text(),
author: $$('#content > article').text().split('Cerpen Karangan: ')[1].split('Kategori: ')[0],
kategori: $$('#content > article').text().split('Kategori: ')[1].split('\n')[0],
lolos: $$('#content > article').text().split('Lolos moderasi pada: ')[1].split('\n')[0],
cerita: $$('#content > article > p').text()
}
resolve(hasil)
})
})
})
}
function getLatestAnime() {
return new Promise((resolve, reject) => {
axios.get('https://www.mynimeku.com/').then(({ data }) => {
let $ = cheerio.load(data)
let result = []
$('div.flexbox-item > a').each(function(i, e) {
let title = $(e).attr('title')
let link = $(e).attr('href')
let status = $(e).find('div.flexbox-status').text()
let thumb = $(e).find('div.flexbox-thumb > img').attr('data-src')
let episode = $(e).find('div.flexbox-episode > span.eps').text().split(' ')[1]
let type = $(e).find('div.flexbox-type').text()
result.push({ title, status, episode, type, thumb, link })
})
resolve(result)
}).catch(reject)
})
}
function getLatestKomik() {
return new Promise((resolve, reject) => {
axios.get('https://www.mynimeku.com/').then(({ data }) => {
let $ = cheerio.load(data)
let result = []
$('div.flexbox4-item').each(function(i, e) {
let title = $(e).find('a').attr('title')
let link = $(e).find('a').attr('href')
let thumb = $(e).find('div.flexbox4-thumb > img').attr('data-src')
let type = $(e).find('div.flexbox4-type').text()
let status = $(e).find('div.flexbox-status').text()
let chapter = $(e).find('ul.chapter > li').text().split(' ')[1]
result.push({ title, status, chapter, type, thumb, link })
})
resolve(result)
}).catch(reject)
})
}
function AnimeDl(url) {
return new Promise((resolve, reject) => {
axios.get(url).then(({ data }) => {
let $ = cheerio.load(data)
let title = $('title').text()
let thumb = $('meta[property="og:image"]').attr('content')
let url = $('#linklist').find('a').attr('href')
resolve({ title, thumb, url })
}).catch(reject)
})
}
function KomikDl(url) {
return new Promise((resolve, reject) => {
axios.get(url).then(({ data }) => {
let $ = cheerio.load(data)
let title = $('title').text().replace('Bahasa Indonesia - MyNimeku', '').trim()
let result = []
$('div.reader-area > p > img').each(function () {
result.push($(this).attr('src'))
})
resolve({ title, result })
}).catch(reject)
})
}
function otakudesu(judul){
return new Promise(async(resolve, reject) => {
axios.get('https://otakudesu.moe/?s=' + judul + '&post_type=anime')
.then(({ data }) => {
const $ = cheerio.load(data)
const result = {};
let limk = $('#venkonten > div > div.venser > div > div > ul > li:nth-child(1) > h2 > a').attr('href')
axios.get(limk).then(({ data }) => {
const $$ = cheerio.load(data)
result.message = 'KirBotz'
result.img = $$('#venkonten > div.venser > div.fotoanime').find('img').attr('src')
$$('#venkonten > div.venser > div.fotoanime > div.infozin > div').each(function(a, b) {
result.judul = $$(b).find('p:nth-child(1)').text().replace('Judul: ','')
result.jepang = $$(b).find('p:nth-child(2)').text().replace('Japanese: ','')
result.rate = $$(b).find('p:nth-child(3)').text().replace('Skor: ','')
result.produser = $$(b).find('p:nth-child(4)').text().replace('Produser: ','')
result.tipe = $$(b).find('p:nth-child(5)').text().replace('Tipe: ','')
result.status = $$(b).find('p:nth-child(6)').text().replace('Status: ','')
result.episode = $$(b).find('p:nth-child(7)').text().replace('Total Episode: ','')
result.durasi = $$(b).find('p:nth-child(8)').text().replace('Durasi: ','')
result.rilis = $$(b).find('p:nth-child(9)').text().replace('Tanggal Rilis: ','')
result.studio = $$(b).find('p:nth-child(10)').text().replace('Studio: ','')
result.genre = $$(b).find('p:nth-child(11)').text().replace('Genre: ','')
result.desc = $$('#venkonten > div.venser > div.fotoanime > div.sinopc').text().replace('.','\n') + $$(b).find('div.sinopc > p:nth-child(2)').text()
result.batch = $$('#venkonten > div.venser > div:nth-child(10) > ul > li > span:nth-child(1) > a').attr('href')
})
const lim = $$('#venkonten > div.venser > div:nth-child(10) > ul > li > span:nth-child(1) > a').attr('href')
axios.get(lim).then(({ data }) => {
const $$$ = cheerio.load(data)
result.batchSD = $$$('#venkonten > div:nth-child(6) > ul > li:nth-child(1) > a:nth-child(3)').attr('href')
result.batchHD = $$$('#venkonten > div:nth-child(6) > ul > li:nth-child(3) > a:nth-child(3)').attr('href')
resolve(result)
})
})
})
.catch(reject)
})
}
module.exports = {
niatsholat,
asmaulhusna,
bacaanshalat,
getDoujin,
onGoing,
kusoNime,
mlstalk,
ffstalk,
npmstalk,
quotesanime,
pornovid,
hentaivid,
nomorhp,
character,
anime,
manga,
searchsticker,
igstalk,
listsurah,
jadwalsholat,
telesticker,
aiovideodl,
linkwa,
mediafiredl,
ytPlayMp4,
ytPlayMp3,
cerpen,
getLatestAnime,
getLatestKomik,
AnimeDl,
KomikDl,
otakudesu }