Skip to content

Commit

Permalink
Update tiktok.js
Browse files Browse the repository at this point in the history
  • Loading branch information
SkulZOnTheYT authored Nov 12, 2023
1 parent 76f1d01 commit 612d4ee
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions plugins/download/tiktok.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
let handler = async (m, { conn, text, args }) => {
if (!/https?:\/\/(www\.|v(t|m|vt)\.|t\.)?tiktok\.com/i.test(args[0])) return m.reply(`Example : #tiktok https://vt.tiktok.com/ZSwWCk5o/`)
import { youtubedl } from '@bochilteam/scraper-sosmed'
import ytdl from 'ytdl-core'
import { niceBytes } from '../../lib/func.js'
import { soundcloud } from '../../lib/scrape.js'
import db from '../../lib/database.js'

export async function before(m, {conn, body}) {
let chat = db.data.settings[conn.user.jid]
if (chat.autodl) {
if (/https?:\/\/(www\.|v(t|m|vt)\.|t\.)?tiktok\.com/i.test(m.text)) {
// return m.reply(`Example : #tiktok https://vt.tiktok.com/ZSwWCk5o/`)
await m.reply("Loading...")
let req = await fetch(global.API('xfarr', '/api/download/tiktoknowm', { url: args[0] }, 'apikey'))
let req = await fetch(global.API('xfarr', '/api/download/tiktoknowm', { url: m.text }, 'apikey')) //GET INFO TIKTOK NOWM
let json = await req.json()
if (json.status !== 200) return m.reply("sukses")
console.log(json.result.url)
conn.sendFile(m.chat, json.result.url, `${json.result.description}.mp4`, '*[ TIKTOK VIDEO DOWNLOADER ]*', m)
if (/music/g.test(json.result.url)) {
let req = await fetch(global.API('xfarr', '/api/download/tiktokslide', { url: args[0] }, 'apikey'))
let json = await req.json()
for (let url of json.result.url) {
console.log(url)
await conn.sendMsg(m.chat, { image: { url: url }, caption: '*[ TIKTOK SLIDE DOWNLOADER ]*' }, { quoted: m })
}
}
}

conn.sendFile(m.chat, json.result.url, `${json.result.description}.mp4`, '[ TIKTOK VIDEO DOWNLOADER ]', m)
}
}
}

handler.help = ['tiktok <url>','tiktokdl <url>', 'tiktokslide <url>']
handler.tags = ['download']
Expand All @@ -25,4 +26,4 @@ handler.command = /^(tiktok(dl)?(slide|image)?)$/i
handler.premium = false
handler.limit = true

export default handler
export default handler

0 comments on commit 612d4ee

Please sign in to comment.