| const cheerio = require('cheerio') |
| const fetch = require('node-fetch') |
| const axios = require("axios") |
| const qs = require("qs") |
|
|
| function quotes(input) { |
| return new Promise((resolve, reject) => { |
| fetch('https://jagokata.com/kata-bijak/kata-' + input.replace(/\s/g, '_') + '.html?page=1') |
| .then(res => res.text()) |
| .then(res => { |
| const $ = cheerio.load(res) |
| data = [] |
| $('div[id="main"]').find('ul[id="citatenrijen"] > li').each(function (index, element) { |
| x = $(this).find('div[class="citatenlijst-auteur"] > a').text().trim() |
| y = $(this).find('span[class="auteur-beschrijving"]').text().trim() |
| z = $(element).find('q[class="fbquote"]').text().trim() |
| data.push({ author: x, bio: y, quote: z }) |
| }) |
| data.splice(2, 1) |
| if (data.length == 0) return resolve({ creator: 'stikerin', status: false }) |
| resolve({ creator: 'stikerin', status: true, data }) |
| }).catch(reject) |
| }) |
| } |
|
|
| function joox(query) { |
| return new Promise((resolve, reject) => { |
| const time = Math.floor(new Date() / 1000) |
| axios.get('http://api.joox.com/web-fcgi-bin//web_search?lang=id&country=id&type=0&search_input=' + query + '&pn=1&sin=0&ein=29&_=' + time) |
| .then(({ data }) => { |
| let result = [] |
| let hasil = [] |
| let promoses = [] |
| let ids = [] |
| data.itemlist.forEach(result => { |
| ids.push(result.songid) |
| }); |
| for (let i = 0; i < data.itemlist.length; i++) { |
| const get = 'http://api.joox.com/web-fcgi-bin/web_get_songinfo?songid=' + ids[i] |
| promoses.push( |
| axios.get(get, { |
| headers: { |
| Cookie: 'wmid=142420656; user_type=1; country=id; session_key=2a5d97d05dc8fe238150184eaf3519ad;' |
| } |
| }) |
| .then(({ data }) => { |
| const res = JSON.parse(data.replace('MusicInfoCallback(', '').replace('\n)', '')) |
| hasil.push({ |
| lagu: res.msong, |
| album: res.malbum, |
| penyanyi: res.msinger, |
| publish: res.public_time, |
| img: res.imgSrc, |
| mp3: res.mp3Url |
| }) |
| Promise.all(promoses).then(() => resolve({ |
| creator: "ariffb", |
| status: true, |
| data: hasil, |
| })) |
| }).catch(reject) |
| ) |
| } |
| }).catch(reject) |
| }) |
| } |
|
|
| function tiktok(url) { |
| return new Promise(async (resolve, reject) => { |
| axios.get('https://ttdownloader.com/', { |
| headers: { |
| "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", |
| "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36", |
| "cookie": "PHPSESSID=9ut8phujrprrmll6oc3bist01t; popCookie=1; _ga=GA1.2.1068750365.1625213061; _gid=GA1.2.842420949.1625213061" |
| } |
| }) |
| .then(({ data }) => { |
| const $ = cheerio.load(data) |
| let token = $('#token').attr('value') |
| let config = { |
| 'url': url, |
| 'format': '', |
| 'token': token |
| } |
| axios('https://ttdownloader.com/req/', { |
| method: 'POST', |
| data: new URLSearchParams(Object.entries(config)), |
| headers: { |
| "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", |
| "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36", |
| "cookie": "PHPSESSID=9ut8phujrprrmll6oc3bist01t; popCookie=1; _ga=GA1.2.1068750365.1625213061; _gid=GA1.2.842420949.1625213061" |
| } |
| }) |
| .then(({ data }) => { |
| const $ = cheerio.load(data) |
| resolve({ |
| nowm: $('div:nth-child(2) > div.download > a').attr('href'), |
| wm: $('div:nth-child(3) > div.download > a').attr('href'), |
| audio: $('div:nth-child(4) > div.download > a').attr('href') |
| }) |
| }) |
| }) |
| .catch(reject) |
| }) |
| } |
|
|
| function twitter(url) { |
| return new Promise((resolve, reject) => { |
| let params = new URLSearchParams() |
| params.append('URL', url) |
| fetch('https://twdown.net/download.php', { method: 'POST', body: params }) |
| .then(res => res.text()) |
| .then(res => { |
| const $ = cheerio.load(res); |
| data = [] |
| $('div.container').find('tbody > tr > td').each(function (index, element) { |
| x = $(this).find('a').attr('href') |
| if (x !== '#') { |
| if (typeof x !== 'undefined') { |
| data.push({ url: x }) |
| } |
| } |
| }) |
| if (data.length == 0) return resolve({ status: false }) |
| resolve({ status: true, data }) |
| }).catch(reject) |
| }) |
| } |
|
|
| function igdl(url) { |
| return new Promise(async (resolve, reject) => { |
| axios.request({ |
| url: 'https://www.instagramsave.com/download-instagram-videos.php', |
| method: 'GET', |
| headers: { |
| "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36", |
| "cookie": "PHPSESSID=ugpgvu6fgc4592jh7ht9d18v49; _ga=GA1.2.1126798330.1625045680; _gid=GA1.2.1475525047.1625045680; __gads=ID=92b58ed9ed58d147-221917af11ca0021:T=1625045679:RT=1625045679:S=ALNI_MYnQToDW3kOUClBGEzULNjeyAqOtg" |
| } |
| }) |
| .then(({ data }) => { |
| const $ = cheerio.load(data) |
| const token = $('#token').attr('value') |
| let config = { |
| headers: { |
| 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8', |
| "sec-ch-ua": '" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"', |
| "cookie": "PHPSESSID=ugpgvu6fgc4592jh7ht9d18v49; _ga=GA1.2.1126798330.1625045680; _gid=GA1.2.1475525047.1625045680; __gads=ID=92b58ed9ed58d147-221917af11ca0021:T=1625045679:RT=1625045679:S=ALNI_MYnQToDW3kOUClBGEzULNjeyAqOtg", |
| "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36", |
| }, |
| data: { |
| 'url': url, |
| 'action': 'post', |
| 'token': token |
| } |
| } |
| axios.post('https://www.instagramsave.com/system/action.php', qs.stringify(config.data), { headers: config.headers }) |
| .then(({ data }) => { |
| resolve(data.medias) |
| }) |
| }) |
| .catch(reject) |
| }) |
| } |
|
|
| function igstory(username) { |
| return new Promise(async (resolve, reject) => { |
| axios.request({ |
| url: 'https://www.instagramsave.com/instagram-story-downloader.php', |
| method: 'GET', |
| headers: { |
| "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36", |
| "cookie": "PHPSESSID=ugpgvu6fgc4592jh7ht9d18v49; _ga=GA1.2.1126798330.1625045680; _gid=GA1.2.1475525047.1625045680; __gads=ID=92b58ed9ed58d147-221917af11ca0021:T=1625045679:RT=1625045679:S=ALNI_MYnQToDW3kOUClBGEzULNjeyAqOtg" |
| } |
| }) |
| .then(({ data }) => { |
| const $ = cheerio.load(data) |
| const token = $('#token').attr('value') |
| let config = { |
| headers: { |
| 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8', |
| "sec-ch-ua": '" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"', |
| "cookie": "PHPSESSID=ugpgvu6fgc4592jh7ht9d18v49; _ga=GA1.2.1126798330.1625045680; _gid=GA1.2.1475525047.1625045680; __gads=ID=92b58ed9ed58d147-221917af11ca0021:T=1625045679:RT=1625045679:S=ALNI_MYnQToDW3kOUClBGEzULNjeyAqOtg", |
| "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36", |
| }, |
| data: { |
| 'url': 'https://www.instagram.com/' + username, |
| 'action': 'story', |
| 'token': token |
| } |
| } |
| axios.post('https://www.instagramsave.com/system/action.php', qs.stringify(config.data), { headers: config.headers }) |
| .then(({ data }) => { |
| resolve(data.medias) |
| }) |
| }) |
| .catch(reject) |
| }) |
| } |
|
|
| function pin(url) { |
| return new Promise(async (resolve, reject) => { |
| let form = new URLSearchParams() |
| form.append('url', url) |
| let html = await (await fetch('https://pinterestvideodownloader.com/', { method: 'POST', body: form })).text() |
| $ = cheerio.load(html) |
| let data = [] |
| $('table > tbody > tr').each(function (i, e) { |
| if ($($(e).find('td')[0]).text() != '') data.push({ |
| url: $($(e).find('td')[0]).find('a').attr('href') |
| }) |
| }) |
| if (data.length == 0) return resolve({ status: false }) |
| resolve({ status: true, data }) |
| }) |
| } |
|
|
|
|
| let is = { |
| headers: { |
| 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8', |
| "sec-ch-ua": '" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"', |
| "cookie": "PHPSESSID=ugpgvu6fgc4592jh7ht9d18v49; _ga=GA1.2.1126798330.1625045680; _gid=GA1.2.1475525047.1625045680; __gads=ID=92b58ed9ed58d147-221917af11ca0021:T=1625045679:RT=1625045679:S=ALNI_MYnQToDW3kOUClBGEzULNjeyAqOtg", |
| "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36", |
| } |
| } |
|
|
| function _token(host) { |
| return new Promise(async (resolve, reject) => { |
| axios.request({ |
| url: host, method: 'GET', headers: { |
| "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36", |
| "cookie": "PHPSESSID=ugpgvu6fgc4592jh7ht9d18v49; _ga=GA1.2.1126798330.1625045680; _gid=GA1.2.1475525047.1625045680; __gads=ID=92b58ed9ed58d147-221917af11ca0021:T=1625045679:RT=1625045679:S=ALNI_MYnQToDW3kOUClBGEzULNjeyAqOtg" |
| } |
| }).then(({ data }) => { |
| let $ = cheerio.load(data) |
| let token = $('#token').attr('value') |
| resolve(token) |
| }) |
| }) |
| } |
|
|
| function facebook(url) { |
| return new Promise(async (resolve, reject) => { |
| let host = 'https://aiovideodl.ml/' |
| let form = { data: { 'url': url, 'token': (await _token(host)) } } |
| axios.post(host + '/system/action.php', qs.stringify(form.data), { headers: is.headers }) |
| .then(({ data }) => { |
| if (data.links.lenght == 0) return resolve({ creator: '@neoxrs – Wildan Izzudin', status: false }) |
| resolve({ creator: '@neoxrs – Wildan Izzudin', status: true, data: data.links }) |
| }) |
| }) |
| } |
|
|
| module.exports = { facebook, quotes, igdl, igstory, tiktok, twitter, joox, pin } |
|
|