11import { generateWAMessageFromContent } from "baileys" ;
2- import Tiktok from "@tobyg74/tiktok-api-dl" ;
2+ import axios from 'axios' ;
33
44const handler = async ( m , { conn, text, args, usedPrefix, command } ) => {
55 const datas = global ;
@@ -23,45 +23,19 @@ const handler = async (m, { conn, text, args, usedPrefix, command }) => {
2323 } , aa ) ;
2424 await conn . relayMessage ( m . chat , prep . message , { messageId : prep . key . id , mentions : [ m . sender ] } ) ;
2525
26- const result = await Tiktok . Downloader ( args [ 0 ] , { version : "v1" } ) ;
27- if ( result . status === "success" ) {
28- const desc1n = `${ tradutor . texto4 [ 0 ] } _${ usedPrefix } tomp3_ ${ tradutor . texto4 [ 1 ] } ` ;
29- await conn . sendMessage ( m . chat , { video : { url : result . result . video . downloadAddr } , caption : desc1n } , { quoted : m } ) ;
30- } else {
31- throw new Error ( result . message ) ;
32- }
33- } catch ( ee1 ) {
34- try {
35- const result = await Tiktok . Downloader ( args [ 0 ] , { version : "v1" } ) ;
36- if ( result . status === "success" ) {
37- const desc1 = `${ tradutor . texto5 [ 0 ] } _${ usedPrefix } tomp3_ ${ tradutor . texto5 [ 1 ] } ` ;
38- await conn . sendMessage ( m . chat , { video : { url : result . result . video . downloadAddr } , caption : desc1 } , { quoted : m } ) ;
39- } else {
40- throw new Error ( result . message ) ;
41- }
42- } catch ( e1 ) {
43- try {
44- const result = await Tiktok . Downloader ( args [ 0 ] , { version : "v1" } ) ;
45- if ( result . status === "success" ) {
46- const desc2 = `${ tradutor . texto6 [ 0 ] } _${ usedPrefix } tomp3_ ${ tradutor . texto6 [ 1 ] } ` ;
47- await conn . sendMessage ( m . chat , { video : { url : result . result . video . downloadAddr } , caption : desc2 } , { quoted : m } ) ;
48- } else {
49- throw new Error ( result . message ) ;
50- }
51- } catch ( e2 ) {
52- try {
53- const result = await Tiktok . Downloader ( args [ 0 ] , { version : "v1" } ) ;
54- if ( result . status === "success" ) {
55- const cap = `${ tradutor . texto8 [ 0 ] } _${ usedPrefix } tomp3_ ${ tradutor . texto8 [ 1 ] } ` ;
56- await conn . sendMessage ( m . chat , { video : { url : result . result . video . downloadAddr } , caption : cap } , { quoted : m } ) ;
57- } else {
58- throw new Error ( result . message ) ;
59- }
60- } catch {
61- throw `${ tradutor . texto9 } ` ;
62- }
63- }
64- }
26+ const response = await axios . get ( `http://40.86.184.153/downloadtiktok` , {
27+ params : {
28+ url : args [ 0 ] ,
29+ type : 'video'
30+ } ,
31+ responseType : 'arraybuffer'
32+ } ) ;
33+ const buff_vid = response . data ;
34+ const desc1n = `${ tradutor . texto4 [ 0 ] } _${ usedPrefix } tomp3_ ${ tradutor . texto4 [ 1 ] } ` ;
35+ await conn . sendMessage ( m . chat , { video : buff_vid , caption : desc1n } , { quoted : m } ) ;
36+ } catch ( error ) {
37+ console . error ( 'Error fetching video:' , error ) ;
38+ throw tradutor . texto9 ;
6539 }
6640} ;
6741
0 commit comments