Skip to content

Instantly share code, notes, and snippets.

@gfwfail
Created December 14, 2022 06:45
Show Gist options
  • Save gfwfail/2ec862e8afce352cf13d0fab831870b8 to your computer and use it in GitHub Desktop.
Save gfwfail/2ec862e8afce352cf13d0fab831870b8 to your computer and use it in GitHub Desktop.
const puppeteer = require('puppeteer-extra')
const StealthPlugin = require('puppeteer-extra-plugin-stealth')
puppeteer.use(StealthPlugin())
// require executablePath from puppeteer
const {executablePath} = require('puppeteer')
async function test() {
const browser = await puppeteer.launch({
args: ['--no-sandbox',],
headless: false,
ignoreHTTPSErrors: true,
executablePath: executablePath(),
})
const graphQLUri = 'https://opensea.io/__api/graphql/';
const page = await browser.newPage()
await page.setRequestInterception(true)
page.on('request', (request) => {
if ([
//'stylesheet',
'image',
'media',
'font',
].indexOf(request.resourceType()) !== -1) {
return request.abort();
}
if (request.url() !== graphQLUri) return request.continue();
if (request.method() !== 'POST') return request.continue();
request.continue()
});
page.on('response', response => {
if (response.url().endsWith(graphQLUri))
console.log("response code: ", response.json().then(x=>console.log(JSON.stringify(x))));
// do something here
});
page.goto("https://opensea.io/collection/azuki/activity?search[eventTypes][0]=OFFER_ENTERED")
}
test();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment