wolfyflutter

75. yt1s.com.co [youtube] [downloader] [audio] [video] [yt1s-worker-3.dlsrv.online]

Dec 9th, 2025
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 2.02 KB | Source Code | 0 0
  1. /*
  2.   by wolep
  3.   update 10 desember 2025
  4.   base https://yt1s.com.co/
  5. */
  6.  
  7. const yt = {
  8.     _static: {
  9.         apiAudio: 'https://dlsrv.online/api/download/mp3',
  10.         apiVideo: 'https://dlsrv.online/api/download/mp4',
  11.         baseHeaders: {
  12.             "accept-encoding": "gzip, deflate, br, zstd",
  13.             "content-type": "application/json",
  14.             "origin": "https://yt1s.com.co",
  15.             "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Mobile/15E148 Safari/604.1"
  16.         },
  17.     },
  18.  
  19.     _resolvePayload: function (userFormat = '128k') {
  20.         const validFormats = ['64k', '96k', '128k', '256k', '320k', '144p', '240p', '360p', '480p', '720p', '1080p']
  21.         if (!validFormats.includes(userFormat)) throw Error(`invalid input '${userFormat}'. please use one of these ${validFormats.join(', ')}`)
  22.         const api = /k$/.test(userFormat.trim()) ? this._static.apiAudio : this._static.apiVideo
  23.         const quality = parseInt(userFormat) + ""
  24.         return { api, quality }
  25.     },
  26.  
  27.     download: async function (videoId, userFormat = '360p') {
  28.         const { api, quality } = this._resolvePayload(userFormat)
  29.         const headers = this._static.baseHeaders
  30.         const body = JSON.stringify({ videoId, quality })
  31.         const r = await fetch(api, { headers, body, method: 'post' })
  32.         if (!r.ok) throw Error(`${r.status} ${r.statusText} di fungsi download`)
  33.         const html = await r.text()
  34.         const downloadUrl = html.match(/href='(.+?)';/)?.[1]
  35.         if (!downloadUrl) throw Error(`gagal mendapatkan download url. regex fail!`)
  36.         return { downloadUrl }
  37.     },
  38. }
  39.  
  40. // cara pakai
  41. yt.download('By7ctqcWxyM')
  42.     .then(console.log)
  43.     .catch(console.log)
  44.  
  45. /* output
  46. {
  47.   downloadUrl: 'https://yt1s-worker-3.dlsrv.online/tunnel?id=JH7DTysSS2xGNqv06ZpPf&exp=1765345200491&sig=lMXhGQ0grMog3jUutcFk3CWbJXDrdEjuPjvoPwE5GBs&sec=pFKd7cpsyIarX1jYufzxnQRB0Htpv-3nNP3ihXRnU0I&iv=_kxeDpzEIMs6-WbX3o7_SA'
  48. }
  49.   */
  50.  
Advertisement
Add Comment
Please, Sign In to add comment