@0xtld/tair-node
Version:
A Node.js package for Tair functionality with configuration, core, and helper modules.
84 lines (56 loc) • 2.11 kB
JavaScript
const { connect } = require("puppeteer-real-browser")
async function test() {
const { browser, page } = await connect({
headless: true,
args: [],
customConfig: {},
turnstile: true,
connectOption: {},
disableXvfb: false,
ignoreAllFlags: false
// proxy:{
// host:'<proxy-host>',
// port:'<proxy-port>',
// username:'<proxy-username>',
// password:'<proxy-password>'
// }
})
await page.setRequestInterception(true);
const urlBlockRequest = [
"https://conversion.seracle.com/getCurrencyConversionMap",
"https://assets.credible.finance/HologramAlien1.mp4",
"https://assets.credible.finance/ai.mp4",
"https://assets.credible.finance/ProtocolBackground.png",
"https://credible.finance/polyfills-O2WOJMNN.js"
]
page.on('request', (request) => {
const url = request.url();
const resourceType = request.resourceType();
const blockTypes = ['websocket'];
if (blockTypes.includes(resourceType)) {
console.log('blocked type', resourceType, url);
request.abort();
}
// check Request is already handled!
if (urlBlockRequest.includes(url)) {
console.log('blocked url', url);
request.abort();
} else {
request.continue();
}
});
const status = await page.goto('https://credible.finance/', { waitUntil: 'networkidle2' });
console.log(status.status());
const script = async (site_key, action) => {
// Wait for the reCAPTCHA script to load
while (typeof grecaptcha === 'undefined' || typeof grecaptcha.enterprise === 'undefined') {
await new Promise(resolve => setTimeout(resolve, 100));
}
// Execute the reCAPTCHA and return the token
const token = await grecaptcha.enterprise.execute(site_key, { action });
return token;
};
const token = await page.evaluate(script, '6LcUH1EpAAAAAHOzn2bNsQu-gVu6e8a4HnmdEa2J', 'registerWithEmail');
console.log(token)
}
test()