diff --git a/README.md b/README.md index 43a45da..80fac36 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,6 @@ const scrape = require("scrape-websitee") { tools: { uploadFile, // (buffer) - enhanceImg, // (url) cekResi, // (kurir, resi) tiktokTts, // (query) ttsModel, diff --git a/package.json b/package.json index 57abb00..3a728d9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scrape-websitee", - "version": "1.0.59", + "version": "1.0.60", "description": "Website Scraping", "main": "index.js", "scripts": { diff --git a/src/ai.js b/src/ai.js index c97cd69..ef84016 100644 --- a/src/ai.js +++ b/src/ai.js @@ -1,13 +1,11 @@ const axios = require("axios") -const { enhanceImg } = require("./tools.js") async function textToImage(text) { try { const { data } = await axios.get("https://tti.photoleapapp.com/api/v1/generate?prompt=" + text) - const enhanceImages = await enhanceImg(data.result_url, 2) const result = { status: true, - url: enhanceImages.url + url: data.result_url } return result } catch (err) { diff --git a/src/downloader.js b/src/downloader.js index f125ce7..7a92561 100644 --- a/src/downloader.js +++ b/src/downloader.js @@ -122,22 +122,30 @@ async function twitterdl(url) { } async function tiktokdl(url) { + let result = {} try { - const { data } = await axios(`https://downloader.bot/api/tiktok/info`, { + const { data } = await axios(`https://tikdownloader.io/api/ajaxSearch`, { method: "post", - data: { url: url }, + data: { q: url, lang: "id" }, headers: { - Accept: "application/json", - "Content-Type": "application/json" + Accept: "*/*", + "Content-Type": "application/x-www-form-urlencoded", + "X-Requested-With": "XMLHttpRequest" } }) - return data + let $ = cheerio.load(data.data) + result.status = true + result.caption = $("div.video-data > div > .tik-left > .thumbnail > .content > .clearfix > h3").text() + result.thumbnail = $("div.video-data > div > div:nth-child(1) > div > div:nth-child(1) > img").attr("src") + result.server1 = $("div.video-data > div > .tik-right > div > p:nth-child(1) > a").attr("href") + result.server2 = $("div.video-data > div > .tik-right > div > p:nth-child(2) > a").attr("href") + result.serverHD = $("div.video-data > div > .tik-right > div > p:nth-child(3) > a").attr("href") + result.mp3 = $("div.video-data > div > .tik-right > div > p:nth-child(4) > a").attr("href") + return result } catch (err) { - const result = { - status: false, - message: "Video not found", - messageCmd: String(err) - } + result.status = false + result.message = "Video not found!" + result.messageCmd = String(err) console.log(result) return result } diff --git a/src/tools.js b/src/tools.js index 7227ccb..4183945 100644 --- a/src/tools.js +++ b/src/tools.js @@ -115,26 +115,6 @@ async function tiktokTts(text, model) { } } -async function enhanceImg(url, scale) { - const scaleNumber = scale ? scale : 2 - const { data } = await axios(`https://toolsapi.spyne.ai/api/forward`, { - method: "post", - data: { - image_url: url, - scale: scaleNumber, - save_params: { - extension: ".png", - quality: 95 - } - }, - headers: { - "content-type": "application/json", - accept: "*/*" - } - }) - return data -} - async function cekResi(kurir, resi) { let { data } = await axios(`https://pluginongkoskirim.com/front/resi`, { method: "post", @@ -149,7 +129,6 @@ async function cekResi(kurir, resi) { module.exports = { uploadFile, - enhanceImg, cekResi, tiktokTts, ttsModel