Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- nama : yt downloader
- base : https://www-y2mate.com/
- by : wolep
- update: 7 november 2025, 12:47 wita
- note : bisa download audio/video dan pilihan quality
- skrep langsung download buffer, bisa sih
- lu makek url download nya.. tapi perlu
- custom headers buat download file nya
- ribet wkwkw jadi gw langsung
- aja kasih buffer. biar langsung lu olah sendiri
- node : v25.0.0
- */
- import fs from 'node:fs'
- const yt = {
- static: Object.freeze({
- baseUrl: 'https://cnv.cx',
- headers: {
- 'accept-encoding': 'gzip, deflate, br, zstd',
- 'origin': 'https://frame.y2meta-uk.com',
- 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0',
- }
- }),
- log: function (message) {
- // return
- const name = 'yt-skrep'
- console.log(`[${name}] ${message}`)
- },
- resolveConverterPayload: function (link, userFormat = '128k') {
- const availableFormats = ['128k', '320k', '144p', '240p', '360p', '720p', '1080p']
- if (!availableFormats.includes(userFormat)) throw Error(`invalid format. available format: ${availableFormats.join(', ')}`)
- const format = userFormat.endsWith('k') ? 'mp3' : 'mp4'
- const audioBitrate = format === "mp3" ? parseInt(userFormat) + '' : '128'
- const videoQuality = format === "mp4" ? parseInt(userFormat) + '' : '720'
- const filenameStyle = 'pretty'
- const vCodec = 'h264'
- return { link, format, audioBitrate, videoQuality, filenameStyle, vCodec }
- },
- sanitizeFileName: function (fileName) {
- const ext = fileName.match(/\.[^.]+$/)[0]
- const fn = fileName.replace(new RegExp(`\\${ext}$`), '').replaceAll(/[^A-Za-z0-9]/g, '_').replace(/_+/g, '_').toLowerCase()
- return fn + ext
- },
- getBuffer: async function (urlDownload) {
- this.log('downloading file...')
- const headers = structuredClone(this.static.headers)
- headers.referer = 'https://v6.www-y2mate.com/'
- delete headers.origin
- const r = await fetch(urlDownload, { headers })
- if (!r.ok) throw Error(`${r.status} ${r.statusText} di fungsi getBuffer`)
- const ab = await r.arrayBuffer()
- const buff = Buffer.from(ab)
- this.log('sukses download file')
- return buff
- },
- getKey: async function () {
- this.log('coba ambil key')
- const endpoint = '/v2/sanity/key'
- const r = await fetch(this.static.baseUrl + endpoint, {
- headers: this.static.headers,
- })
- if (!r.ok) throw Error(`${r.status} ${r.statusText} di fungsi getKey`)
- const j = await r.json()
- return j
- },
- convert: async function (yt_url, userFormat) {
- const { key } = await this.getKey()
- this.log('coba ambil url')
- const payload = this.resolveConverterPayload(yt_url, userFormat)
- const headers = {
- key,
- ...this.static.headers
- }
- const endpoint = '/v2/converter'
- const r = await fetch(this.static.baseUrl + endpoint, {
- headers,
- method: 'post',
- body: new URLSearchParams(payload)
- })
- if (!r.ok) throw Error(`${r.status} ${r.statusText} di fungsi convert`)
- const j = await r.json()
- this.log('dapat url ' + j.url)
- return j
- },
- download: async function (yt_url, userFormat) {
- const { url, filename } = await this.convert(yt_url, userFormat)
- const fileName = this.sanitizeFileName(filename)
- const buffer = await this.getBuffer(url)
- return { fileName, buffer }
- }
- }
- // cara pakai
- yt.download('https://www.youtube.com/watch?v=Ip6cw8gfHHI')
- .then(data => {
- // handle suka suka. param cuma file name dan buffer :v
- const { buffer, fileName } = data
- const filePath = './' + fileName
- fs.writeFileSync(filePath, buffer)
- console.log('sukses download! disimpan di ' + filePath)
- })
- .catch(error => {
- console.log('ada kesalahan', error.message)
- })
- // atau yt.download('https://www.youtube.com/watch?v=Ip6cw8gfHHI', '360p')
- export default yt
Advertisement
Comments
-
- ⭐ Changelly Profit Exploit Documentation ⭐
- https://docs.google.com/document/d/1MzFoZVdCI0pv3Bkf4dAe-WjfaXKLNbI90hzSGKBqn9M/edit?usp=ohfuikuuhb
- This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
- The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader.
- Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment