File size: 2,281 Bytes
7c363b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
const axios = require('axios');

async function likee(url) {
  try {
    const apiResponse = await axios.post(
      'https://steptodown.com/wp-json/aio-dl/video-data/',
      { url: url },
      {
        headers: {
          'Content-Type': 'application/json',
          'Origin': 'https://steptodown.com',
          'Referer': 'https://steptodown.com/',
          'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
          'Accept': 'application/json, text/plain, */*',
          'Accept-Language': 'en-US,en;q=0.9',
          'Sec-Fetch-Dest': 'empty',
          'Sec-Fetch-Mode': 'cors',
          'Sec-Fetch-Site': 'same-origin'
        },
        timeout: 15000
      }
    );

    const apiData = apiResponse.data;

    return {
      url: apiData.url || url,
      title: apiData.title || null,
      thumbnail: apiData.thumbnail || null,
      duration: apiData.duration || null,
      source: apiData.source || 'likee',
      medias: apiData.medias || [],
      sid: apiData.sid || null
    };
  } catch (error) {
    throw new Error(error.message);
  }
}

const handler = async (req, res) => {
  try {
    const { url } = req.query;

    if (!url) {
      return res.status(400).json({
        author: 'Herza',
        success: false,
        error: 'Missing required parameter: url',
        message: 'Please provide a Likee video URL'
      });
    }

    if (!url.includes('likee.video') && !url.includes('likee.com')) {
      return res.status(400).json({
        author: 'Herza',
        success: false,
        error: 'Invalid URL',
        message: 'Please provide a valid Likee video URL'
      });
    }

    const result = await likee(url);

    res.json({
      author: 'Herza',
      success: true,
      data: result
    });
  } catch (error) {
    res.status(500).json({
      author: 'Herza',
      success: false,
      error: error.message
    });
  }
};

module.exports = {
  name: 'Likee Downloader',
  description: 'Download Likee videos without watermark using steptodown API',
  type: 'GET',
  routes: ['api/download/likee'],
  tags: ['tools', 'likee', 'downloader', 'social-media'],
  main: ['Downloader'],
  parameters: ['url', 'key'],
  enabled: true,
  handler
};