import axios from 'axios'; | |
import { trbtoken } from '../all.js'; | |
async function TeraboxV2Downloader(url) { | |
const options = { | |
method: 'GET', | |
url: 'https://terabox-downloader-direct-download-link-generator2.p.rapidapi.com/url', | |
headers: { | |
'x-rapidapi-key': `${trbtoken}`, | |
'x-rapidapi-host': 'terabox-downloader-direct-download-link-generator2.p.rapidapi.com', | |
}, | |
params: { | |
url: url | |
} | |
}; | |
try { | |
const response = await axios.request(options); | |
return response.data; | |
} catch (error) { | |
console.error(error); | |
return null; | |
} | |
} | |
async function TeraboxDownloader(url) { | |
const options = { | |
method: 'POST', | |
url: 'https://terabox-downloader-direct-download-link-generator.p.rapidapi.com/fetch', | |
headers: { | |
'x-rapidapi-key': `${trbtoken}`, | |
'x-rapidapi-host': 'terabox-downloader-direct-download-link-generator.p.rapidapi.com', | |
'Content-Type': 'application/json' | |
}, | |
data: { | |
url: url | |
} | |
}; | |
try { | |
const response = await axios.request(options); | |
return response.data; | |
} catch (error) { | |
console.error(error); | |
return null; | |
} | |
} | |
export { TeraboxDownloader, TeraboxV2Downloader }; |