qrtzcode
HomeDocsAPILeaderboardChangelog
Contribute
Docs

qrtzcode

Kumpulan gist & snippet pribadi — anime, AI tools, scraper, dan randomness.

Navigate

HomeDocsAPI Reference

Links

© 2026 qrtz. All snippets welcome.

ESC

Navigate

Links

Download

snapsave

download tinggal download.

Note

yh.

Creator

qrtz

Language

javascript

Views

16

Copies

2

Base

https://snapsave.app

Updated

24 Jun 2026

#instagram#download

Code

162
snapsave.js
import crypto from 'node:crypto'

const BASE = 'https://snapsave.app'
const UA = [
  'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Mobile Safari/537.36',
  'Mozilla/5.0 (Linux; Android 14; Pixel 8 Pro) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Mobile Safari/537.36',
  'Mozilla/5.0 (iPhone; CPU iPhone OS 18_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.2 Mobile/15E148 Safari/604.1',
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36'
]
const pick = a => a[Math.floor(Math.random() * a.length)]

function randGa(){return'GA1.1.'+Math.floor(Math.random()*2e9)+'.'+Math.floor(Date.now()/1e3)}
function randSess(){return crypto.randomBytes(13).toString('hex').slice(0,26)}
function makeCookie(){
  const t=Math.floor(Date.now()/1e3)
  return `_ga=${randGa()}; PHPSESSID=${randSess()}; __jscuActive=true; _ga_WNPZGVDWE9=GS2.1.s${t}$o1$g0$t${t}$j60$l0$h0`
}

function convertBase(v,f,t){
  const c='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/'.split('')
  const fc=c.slice(0,f),tc=c.slice(0,t)
  let n=v.split('').reverse().reduce((a,c,i)=>{const p=fc.indexOf(c);return p!==-1?a+p*Math.pow(f,i):a},0)
  let o='';while(n>0){o=tc[n%t]+o;n=Math.floor(n/t)}
  return o||'0'
}

function decodeEval(h){
  const m=h.match(/eval\(function\(h,u,n,t,e,r\)[\s\S]*?\}\("([^"]+)",(\d+),"([^"]+)",(\d+),(\d+),(\d+)\)\)/)
  if(!m)return h
  const s=m[1],a=m[3],t=+m[4],e=+m[5],d=a[e]
  let r=''
  for(let i=0;i<s.length;i++){let c='';while(i<s.length&&s[i]!==d)c+=s[i++];for(let j=0;j<a.length;j++)c=c.replaceAll(a[j],String(j));r+=String.fromCharCode(Number(convertBase(c,e,10))-t)}
  return decodeURIComponent(escape(r))
}

function clean(t){return t.replaceAll('\\"','"').replaceAll('\\/','/').replaceAll('&amp;','&').replaceAll('\\n','').replaceAll('\\t','').trim()}

function extract(t){
  const u=[]
  for(const m of t.matchAll(/href="([^"]+)"/g)){
    const l=m[1]
    if(!l.includes('rapidcdn.app')&&!l.includes('cdninstagram.com')&&!l.includes('fbcdn.net')&&!l.includes('cdninstagram'))continue
    let y='unknown'
    if(/\.mp4|\/v2\?token=|video/i.test(l))y='video'
    else if(/thumb|\.jpg|\.jpeg|\.png|image/i.test(l))y='thumbnail'
    u.push({type:y,url:l})
  }
  const s=new Set()
  return u.filter(v=>!s.has(v.url)&&s.add(v.url))
}

async function snapsave(url){
  const f=new FormData();f.append('url',url)
  const r=await fetch(`${BASE}/id/action.php?lang=id`,{
    method:'POST',
    headers:{
      'user-agent':pick(UA),
      'sec-ch-ua':'"Google Chrome";v="147","Not.A/Brand";v="8","Chromium";v="147"',
      'sec-ch-ua-mobile':'?1',
      'sec-ch-ua-platform':'"Android"',
      'accept-language':'id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7',
      'accept':'*/*',
      origin:BASE,
      referer:`${BASE}/id/download-video-instagram`,
      'sec-fetch-site':'same-origin',
      'sec-fetch-mode':'cors',
      'sec-fetch-dest':'empty',
      cookie:makeCookie()
    },
    body:f
  })
  const raw=await r.text()
  const dec=decodeEval(raw)
  const res=extract(clean(dec))
  return{
    creator:'rynaqrtz',
    status:r.ok&&res.length>0,
    code:r.status,
    input:url,
    result:res,
    raw:res.length?undefined:dec.substring(0,500)
  }
}

if(process.argv[1]?.includes('snapsave.js')){
  const u=process.argv[2]||'https://www.instagram.com/reel/DU8fWy6E_td/'
  snapsave(u).then(d=>console.log(JSON.stringify(d,null,2))).catch(e=>console.log(JSON.stringify({creator:'rynaqrtz',status:false,error:e.message},null,2)))
}

Rating

—(0)

Gimana snippet ini menurutmu?

</> Embed

Embed ke website / blog

<iframe src="https://qrtzcode.vercel.app/api/embed/download/snapsave" style="width:100%;height:400px;border:none;border-radius:12px;"></iframe>

Related Snippets

snaptik

gtw.

11
2