Skip to content

Instantly share code, notes, and snippets.

@YogaSakti
Created October 26, 2022 09:26
Show Gist options
  • Save YogaSakti/b1985d08c784339b54ed6dbb0f895d6c to your computer and use it in GitHub Desktop.
Save YogaSakti/b1985d08c784339b54ed6dbb0f895d6c to your computer and use it in GitHub Desktop.
curl impersonate + curl generator
const { CurlGenerator } = require('curl-generator')
const shell = require('shelljs');
const baseProgram = `${process.cwd()}/curl_impersonate -sS`
const createCurlCommand = (url, method, authorization, body) => {
const params = { url, method,
headers: {
authority: 'aptos-mainnet-api.bluemove.net',
accept: 'application/json, text/plain, */*',
'accept-language': 'id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7',
authorization,
origin: 'https://bluemove.net',
referer: 'https://bluemove.net/',
'sec-ch-ua': '"Chromium";v="106", "Google Chrome";v="106", "Not;A=Brand";v="99"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"macOS"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-site',
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36'
}
}
if (body) params.body = body
const generateCommand = CurlGenerator(params, { silent: true, compressed: true })
return generateCommand.replace('curl', '')
}
const getLaunchpads = () => new Promise((resolve, reject) => {
const command = createCurlCommand(encodeURI('https://aptos-mainnet-api.bluemove.net/api/launchpads?sort[0]=start_time%3Adesc'), 'GET', token, '');
const request = shell.exec(`${baseProgram} ${command}`, { async: false, silent: true }).stdout;
resolve(request)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment