Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async function yt(ytid, format) {
- const validFormat = ["128kbps", "192kbps", "256kbps", "320kbps", "360p", "480p", "720p", "1080p"]
- if (!validFormat.includes(format)) throw Error(`invalid format. pick one: ${validFormat.join(", ")}`)
- const headers = {
- origin: "https://clickapi.net"
- }
- async function hit(path, method, body) {
- try {
- const baseUrl = 'https://api.cdnframe.com'
- const config = { method, headers, body: JSON.stringify(body) }
- const r = await fetch(baseUrl + path, config)
- if (!r.ok) throw Error(`${r.status} ${r.statusText}\n${await r.text() || `(body kosong)`}`)
- const j = await r.json()
- return j
- } catch (e) {
- throw Error(`hit gagal. ${path}. ${e.message}`)
- }
- }
- function handleFormat(format, info) {
- const kind = /kbps/.test(format) ? 'audio' : 'video'
- const aOrv = info.formats[kind]
- aOrv.sort((a, b) => b.quality - a.quality)
- let result = aOrv.find(v => v.quality === parseInt(format))
- if (!result) {
- result = aOrv[0]
- console.log(`format ${format} tidak tersedia. auto fallback ke best available format ${result.quality} ${/kbps/.test(format) ? 'kbps' : 'p'}`)
- }
- return result
- }
- // get auth
- const auth = await hit('/api/v5/auth', 'post')
- headers.authorization = 'Bearer ' + auth.token
- const info = await hit('/api/v5/info/' + ytid, 'get')
- const { token } = handleFormat(format, info)
- const { jobId } = await hit('/api/v5/convert', 'post', { token })
- let json, hitCount = 0
- const MAX_ATTEMPT = 40
- do {
- json = await hit('/api/v5/status/' + jobId, 'get')
- hitCount++
- if (json.downloadUrl !== null) {
- return json
- } else if (json.status == "failed") {
- throw Error(`gagal memproses video\n${JSON.stringify(json, null, 2)}`)
- }
- console.log(`progress : ${json.step || `unknown step`} ${json.step_progress || 0}%`)
- await new Promise(re => setTimeout(re, 3000))
- } while (hitCount < MAX_ATTEMPT)
- throw Error(`mencapai max attempt hit`)
- }
- yt("13ARO0HDZsQ", "128kbps")
- .then(console.log)
- .catch(e => console.log(e.message))
Advertisement
Comments
-
- ⭐ Changelly Profit Exploit Documentation ⭐
- https://docs.google.com/document/d/1MzFoZVdCI0pv3Bkf4dAe-WjfaXKLNbI90hzSGKBqn9M/edit?usp=vrklzcxedp
- 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