Created
December 20, 2025 18:45
-
-
Save ONLym22/77e0885affe6108138765754df71203f to your computer and use it in GitHub Desktop.
ONLym BOT Gist Uploaded
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| π Name : Youtube Downloader | |
| π·οΈ Type : Takut di gorenk njing | |
| π¦ Saluran : https://whatsapp.com/channel/0029Vb4HHTJFCCoYgkMjn93K | |
| π Noted : Pikirkan secara logika, btw follow bang | |
| π Base Url : https://www.ytbsaver.com | |
| π€ Creator : Hazel | |
| */ | |
| const puppeteer = require('puppeteer-extra'); | |
| const StealthPlugin = require('puppeteer-extra-plugin-stealth'); | |
| puppeteer.use(StealthPlugin()); | |
| async function ytbVideoDetail(videoUrl) { | |
| const browser = await puppeteer.launch({ | |
| headless: 'new', | |
| args: [ | |
| '--no-sandbox', | |
| '--disable-setuid-sandbox', | |
| '--disable-dev-shm-usage', | |
| '--disable-blink-features=AutomationControlled' | |
| ] | |
| }); | |
| const page = await browser.newPage(); | |
| await page.setUserAgent( | |
| 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 ' + | |
| '(KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36' | |
| ); | |
| await page.setViewport({ width: 1366, height: 768 }); | |
| await page.goto('https://www.ytbsaver.com', { | |
| waitUntil: 'networkidle2' | |
| }); | |
| await new Promise(r => setTimeout(r, 2000)); | |
| const result = await page.evaluate(async (url) => { | |
| const res = await fetch( | |
| 'https://api.ytbvideoly.com/api/thirdvideo/parse', | |
| { | |
| method: 'POST', | |
| headers: { | |
| 'content-type': 'application/x-www-form-urlencoded' | |
| }, | |
| body: new URLSearchParams({ | |
| url, | |
| from: 'ytbdownload' | |
| }) | |
| } | |
| ); | |
| return await res.json(); | |
| }, videoUrl); | |
| await browser.close(); | |
| if (result.errno !== 0) { | |
| throw new Error('parse gagal'); | |
| } | |
| const v = result.data; | |
| return { | |
| title: v.title, | |
| thumbnail: v.thumbnail, | |
| duration: v.duration, | |
| best: { | |
| url: v.best_down_url, | |
| manifest: v.best_manifest_url | |
| }, | |
| videos: v.videos || {}, | |
| audios: v.audios || {} | |
| }; | |
| } | |
| // USAGE | |
| ytbVideoDetail('https://www.youtube.com/watch?v=CfdkLVxVJC0') | |
| .then(console.log) | |
| .catch(console.error); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment