| const axios = require('axios'); |
| const cheerio = require('cheerio'); |
|
|
| async function notube(url, format, lang, subscribed) { |
| try { |
| const response = await axios({ |
| method: 'post', |
| url: 'https://s53.notube.lol/recover_weight.php', |
| headers: { |
| 'Accept': 'text/html, */*; q=0.01', |
| 'Accept-Language': 'id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7', |
| 'Connection': 'keep-alive', |
| 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', |
| 'Origin': 'https://notube.lol', |
| 'Referer': 'https://notube.lol/', |
| 'Sec-Fetch-Dest': 'empty', |
| 'Sec-Fetch-Mode': 'cors', |
| 'Sec-Fetch-Site': 'same-site', |
| 'User-Agent': 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Mobile Safari/537.36', |
| 'sec-ch-ua': '"Not A(Brand";v="8", "Chromium";v="132"', |
| 'sec-ch-ua-mobile': '?1', |
| 'sec-ch-ua-platform': '"Android"' |
| }, |
| data: `url=${encodeURIComponent(url)}&format=${encodeURIComponent(format)}&lang=${encodeURIComponent(lang)}&subscribed=${encodeURIComponent(subscribed)}`, |
| responseType: 'json' |
| }); |
|
|
| return response.data; |
| } catch (error) { |
| console.error('Error fetching video data:', error); |
| throw error; |
| } |
| }; |
|
|
| async function tiktok(url) { |
| const { data } = await axios.get(`https://www.tikwm.com/api?url=${url}&hd=1`); |
| if(!data.status !== 0) return { status: false, r: 'error' }; |
| return { status: true, url: data.data.play, hd: data.data.hdplay, audio: data.data.music_info.play }; |
| }; |
|
|
| async function instagram(url) { |
| const { data } = await axios.post( |
| 'https://yt1s.io/api/ajaxSearch', |
| new URLSearchParams({ |
| p: 'home', |
| q: url, |
| w: '', |
| lang: 'en' |
| }), |
| { |
| headers: { |
| 'User-Agent': 'Postify/1.0.0', |
| 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', |
| 'Accept': 'application/json, text/plain, */*', |
| 'Origin': 'https://yt1s.io', |
| 'Referer': 'https://yt1s.io/' |
| } |
| } |
| ) |
|
|
| const $ = cheerio.load(data.data) |
| const rres = []; |
| $('a.abutton.is-success.is-fullwidth.btn-premium') |
| .map((_, el) => { |
| rres.push($(el).attr('href')); |
| }) |
| .get() |
| return { url: rres } |
| } |
|
|
| async function threads(url) { |
| try { |
| const apiUrl = `https://snapthreads.net/api/download?url=${encodeURIComponent(url)}`; |
|
|
| const response = await axios.get(apiUrl, { |
| headers: { |
| "User-Agent": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Mobile Safari/537.36", |
| "Referer": "https://snapthreads.net/id", |
| "Accept": "*/*", |
| "X-Requested-With": "XMLHttpRequest" |
| } |
| }); |
| if (response.data && response.data.directLink) { |
| return { |
| success: true, |
| url: response.data.directLink |
| }; |
| } else { |
| return { |
| success: false, |
| r: 'cant find download link' |
| }; |
| } |
| } catch (error) { |
| console.error("Error:", error.response ? error.response.data : error.message); |
| return { |
| success: false, |
| r: error.response ? error.response.data : error.message |
| }; |
| } |
| } |
|
|
| async function twitter(url) { |
| const regex = /https?:\/\/?(?:mobile\.)?(?:www\.)?(?:twitter\.com|x\.com)\/(?:\w+\/status\/)?(\d+)/; |
| if(!regex.test(url)) return { status: false, r: 'cant find video id' }; |
| const match = url.match(regex); |
| const id = match ? match[1] : null; |
| const res = (await axios.get(`https://tweeload.com/download/${id}`)).data |
| const $ = cheerio.load(res); |
| const section = $('section.content__section.download_result_section'); |
| const link = section.find('a.btn').attr('href'); |
| const name = section.find('.download__item__profile_pic span').first().text(); |
| const username = section.find('.download__item__profile_pic span').last().text(); |
| return { |
| url: link |
| }; |
| } |
|
|
| module.exports = { notube, tiktok, instagram, threads, twitter }; |