Skip to content

Commit

Permalink
delete enhance image + fix tiktok downloader and text to image
Browse files Browse the repository at this point in the history
  • Loading branch information
thoriqazzikraa committed Jan 23, 2024
1 parent 7af9fe6 commit f0ec19e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 36 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const scrape = require("scrape-websitee")
{
tools: {
uploadFile, // (buffer)
enhanceImg, // (url)
cekResi, // (kurir, resi)
tiktokTts, // (query)
ttsModel,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scrape-websitee",
"version": "1.0.59",
"version": "1.0.60",
"description": "Website Scraping",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 1 addition & 3 deletions src/ai.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
28 changes: 18 additions & 10 deletions src/downloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
21 changes: 0 additions & 21 deletions src/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -149,7 +129,6 @@ async function cekResi(kurir, resi) {

module.exports = {
uploadFile,
enhanceImg,
cekResi,
tiktokTts,
ttsModel
Expand Down

0 comments on commit f0ec19e

Please sign in to comment.