Update index.js
Browse files103 unmodified lines104105106107108109875 unmodified lines98598698798898999010 unmodified lines1001100210031004100510061007103 unmodified lines}}// MEDIAFIRE DLasync function mediafire(url) {return new Promise(async (resolve, reject) => {875 unmodified lineslet video = await ytmp4(url);let audio = await ytmp3(url);let data;try {10 unmodified linesaudio: {...audio,...(data && data.mp3 ? { url_v2: data.mp3 } : {})}};return res.json(response);103 unmodified lines104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142875 unmodified lines101810191020102110221023102410 unmodified lines10351036103710381039104010411042103 unmodified lines}}async function ytdlhamster(url) {try {// Melakukan permintaan GET menggunakan axiosconst response = await axios.get(`https://ytdl.hamsterlabs.de/?url=${encodeURIComponent(url)}`);const data = response.data;// Menggunakan cheerio untuk mem-parsing HTMLconst $ = cheerio.load(data);const downloadLinks = [];// Memproses setiap baris tabel kecuali header$('.formats tr').each((i, elem) => {if (i === 0) return; // Skip the header row// Mengambil informasi dari setiap kolom dalam barisconst format = $(elem).find('td:nth-child(1) .format').text().trim();const quality = $(elem).find('td:nth-child(2)').text().trim();const bitrate = $(elem).find('td:nth-child(3)').text().trim();const container = $(elem).find('td:nth-child(4)').text().trim();const codecs = $(elem).find('td:nth-child(5)').text().trim();const downloadUrl = $(elem).find('td:nth-child(6) a').attr('href');// Menambahkan link unduhan ke daftardownloadLinks.push({ format, quality, bitrate, container, codecs, url: downloadUrl });});return downloadLinks;} catch (error) {console.error('Error fetching data:', error);throw error;}}// MEDIAFIRE DLasync function mediafire(url) {return new Promise(async (resolve, reject) => {875 unmodified lineslet video = await ytmp4(url);let audio = await ytmp3(url);let any = await ytdlhamster(url)let data;try {10 unmodified linesaudio: {...audio,...(data && data.mp3 ? { url_v2: data.mp3 } : {})},any};return res.json(response);
index.js+36-1