Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- base : https://ytmp3.cx
- update : 21 agustus 2025
- by : wolep
- node : v24.5.0
- note : buat download mp3, mp4 dari
- youtube biasa, youtube short
- dan youtube music
- support esm dan cjs
- skrep nya kadang ku cek ya
- */
- const ytmp3 = {
- get baseHeaders() {
- return {
- 'accept-encoding': 'gzip, deflate, br, zstd'
- }
- },
- get url() {
- return {
- origin: 'https://ytmp3.cx'
- }
- },
- extractVideoId: function (fV) {
- let v
- if (fV.indexOf('youtu.be') > -1) {
- v = /\/([a-zA-Z0-9\-\_]{11})/.exec(fV);
- } else if (fV.indexOf('youtube.com') > -1) {
- if (fV.indexOf('/shorts/') > -1) {
- v = /\/([a-zA-Z0-9\-\_]{11})/.exec(fV);
- } else {
- v = /v\=([a-zA-Z0-9\-\_]{11})/.exec(fV);
- }
- }
- const result = v?.[1]
- if (!result) throw Error(`gagal extract video id`)
- return result
- },
- getInitUrl: async function () {
- "use strict"
- try {
- const r1 = await fetch(this.url.origin, { headers: this.baseHeaders })
- console.log('hit homepage')
- const html = await r1.text()
- const jsPath = html.match(/<script src="(.+?)"/)?.[1]
- const jsUrl = this.url.origin + jsPath
- const r2 = await fetch(jsUrl, { headers: this.baseHeaders })
- console.log('hit js')
- const js = await r2.text()
- // ayo main eval evalan
- // cari gB
- const gB_m = js.match(/gB=(.+?),gD/)?.[1]
- const gB = eval(gB_m)
- // cari gC
- const html_m = html.match(/<script>(.+?)<\/script>/)?.[1]
- const hiddenGc = eval(html_m + "gC")
- const gC = Object.fromEntries(Object.getOwnPropertyNames(hiddenGc).map(key => [key, hiddenGc[key]]))
- // fungsi
- const decodeBin = (d) => d.split(' ').map(v => parseInt(v, 2))
- const decodeHex = (d) => d.match(/0x[a-fA-F0-9]{2}/g).map(v => String.fromCharCode(v)).join("")
- function authorization() {
- var dec = decodeBin(gC.d(1)[0]);
- var k = '';
- for (var i = 0; i < dec.length; i++) k += (gC.d(2)[0] > 0) ? atob(gC.d(1)[1]).split('').reverse().join('')[(dec[i] - gC.d(2)[1])] : atob(gC.d(1)[1])[(dec[i] - gC.d(2)[1])];
- if (gC.d(2)[2] > 0) k = k.substring(0, gC.d(2)[2]);
- switch (gC.d(2)[3]) {
- case 0:
- return btoa(k + '_' + decodeHex(gC.d(3)[0]));
- case 1:
- return btoa(k.toLowerCase() + '_' + decodeHex(gC.d(3)[0]));
- case 2:
- return btoa(k.toUpperCase() + '_' + decodeHex(gC.d(3)[0]));
- }
- }
- const api_m = js.match(/t.open\("GET",(.+?),!/)?.[1]
- const apiUrl = eval(api_m)
- return apiUrl
- } catch (e) {
- throw new Error('fungsi getApiUrl gagal')
- }
- },
- download: async function (url, f = 'mp3') {
- // validation format
- if (!/^mp3|mp4$/.test(f)) throw Error(`format valid mp3 or mp4`)
- // extract video id
- const v = this.extractVideoId(url)
- const headers = {
- 'referer': this.url.origin,
- ...this.baseHeaders
- }
- // get init url
- const initApi = await this.getInitUrl()
- // hit init
- const r1 = await fetch(initApi, { headers })
- console.log('hit init')
- const j1 = await r1.json()
- const { convertURL } = j1
- // hit convertURL
- const convertApi = convertURL + '&v=' + v + '&f=' + f + '&_=' + Math.random()
- const r2 = await fetch(convertApi, { headers })
- console.log('hit convert url')
- const j2 = await r2.json()
- if (j2.error) {
- throw Error(`ada error di value convert. nih\n${JSON.stringify(j2, null, 2)}`)
- }
- if (j2.redirectURL) {
- const r3 = await fetch(j2.redirectURL, { headers })
- console.log('hit redirect')
- const j3 = await r3.json()
- const result = {
- title: j3.title,
- downloadURL: j3.downloadURL,
- format: f
- }
- return result
- } else {
- // luping
- let j3b
- do {
- const r3b = await fetch(j2.progressURL, { headers })
- console.log('hit progress')
- j3b = await r3b.json()
- if (j3b.error) throw Error(`ada error pas cek progress. nih\n${JSON.stringify(j3b, null, 2)}`)
- if (j3b.progress == 3) {
- const result = {
- title: j3b.title,
- downloadURL: j2.downloadURL,
- format: f
- }
- return result
- }
- await new Promise(resolve => setTimeout(resolve, 3000))
- } while (j3b.error != 3)
- }
- }
- }
- // cara pakai
- ytmp3.download('https://www.youtube.com/watch?v=Fmf-G9fpwto', 'mp3')
- .then(console.log)
- .catch(console.log)
- /* output
- {
- title: 'Diamond Eyes - Stars | Dubstep | NCS - Copyright Free Music',
- downloadURL: 'https://eoeo.ecoe.cc/api/v1/download?sig=ag0......V%2FEi32wlBWQ%3D%3D',
- format: 'mp3'
- }
- atauuuuu.....
- ytmp3.download('yt_url', 'mp4') -> untuk download mp4
- ytmp3.download('yt_url', 'mp3') -> untuk download mp3
- ytmp3.download('yt_url') -> empty param download mp3 juga
- */
Advertisement
Comments
-
- ⭐ Changelly Profit Exploit Documentation ⭐
- https://docs.google.com/document/d/1MzFoZVdCI0pv3Bkf4dAe-WjfaXKLNbI90hzSGKBqn9M/edit?usp=chipznyuct
- 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