| const axios = require('axios'); | |
| async function douyin(url) { | |
| if (!url) { | |
| return { | |
| author: "Herza", | |
| success: false, | |
| error: "URL is required" | |
| }; | |
| } | |
| try { | |
| const response = await axios.post("https://snapdouyin.app/wp-json/mx-downloader/video-data/", | |
| { url }, | |
| { | |
| headers: { | |
| "Content-Type": "application/json", | |
| "Origin": "https://snapdouyin.app", | |
| "Referer": "https://snapdouyin.app/" | |
| } | |
| } | |
| ); | |
| return { | |
| author: "Herza", | |
| success: true, | |
| data: response.data | |
| }; | |
| } catch (error) { | |
| return { | |
| author: "Herza", | |
| success: false, | |
| error: error.message | |
| }; | |
| } | |
| } | |
| const handler = async (req, res) => { | |
| try { | |
| const { url } = req.query; | |
| if (!url) { | |
| return res.status(400).json({ | |
| success: false, | |
| error: 'Missing required parameter: url' | |
| }); | |
| } | |
| const result = await douyin(url); | |
| res.json(result); | |
| } catch (error) { | |
| res.status(500).json({ | |
| success: false, | |
| error: error.message | |
| }); | |
| } | |
| }; | |
| module.exports = { | |
| name: 'Douyin DL', | |
| description: 'Download Douyin Video', | |
| type: 'GET', | |
| routes: ['api/download/douyin'], | |
| tags: ['downloader', 'tools', 'misc'], | |
| parameters: ['url', 'key'], | |
| enabled: true, | |
| main: ['Downloader'], | |
| handler | |
| }; |