Comments (3)
Not Currently, it's in backlog, I except to do it this year. Till then you can use code like execute_js
and run similar code
(function () {
if (window.hasRun) {
return
}
window.hasRun = true
// Store the original fetch function in a variable
const originalFetch = window.fetch
window.fetch = async function (...args) {
if (true) {
try {
// Call the original fetch function
const response = await originalFetch.apply(this, args)
// Clone the response to not interfere with the original processing
const clonedResponse = response.clone()
// Read the response as JSON and log it
clonedResponse.json().then(json => {
console.log(json)
})
// Return the original response
return response
} catch (error) {
console.error('Error in fetch interceptor:', error)
throw error // Re-throw the error for proper error handling
}
}
else {
// Call the original fetch function for other URLs
return originalFetch.apply(this, args)
}
}
})()```
from botasaurus.
use this code to spy on xhr
var originalSend = XMLHttpRequest.prototype.send
// Override the send method
XMLHttpRequest.prototype.send = function () {
// Keep a reference to the XMLHttpRequest instance
var xhr = this
// Function to handle the state change
function onReadyStateChange() {
if (xhr.readyState === 4) { // Check if the request is complete
try {
// Attempt to parse JSON response
var json = JSON.parse(xhr.responseText)
// Log the URL and JSON response to the console
console.log("URL: " + xhr.responseURL)
console.log("Response: ", json)
window.data = json
} catch (e) {
// If response is not JSON, log an error
console.error("Could not parse JSON response for URL: " + xhr.responseURL)
}
}
}
// Add the event listener for 'readystatechange'
this.addEventListener('readystatechange', onReadyStateChange)
// Call the original send method
originalSend.apply(this, arguments)
}
from botasaurus.
ty
from botasaurus.
Related Issues (20)
- Unable to pass steamdb detection HOT 1
- Unable to scrape G2.com HOT 1
- Node version error HOT 1
- Error: connect ECONNREFUSED HOT 2
- Botasaurus perfomance HOT 1
- Dockerfile HOT 4
- Request, Stealth Mode not working HOT 1
- Browser Visible Mode Doesn't Work: ECONNREFUSED HOT 5
- Can't make post request with payload and headers while stealth is on HOT 1
- Chromium fails to start
- Cloudlfare bypass doesnt work HOT 11
- cookieError while making request to server. HOT 2
- Node is installed, but not found. HOT 1
- check_hostname requires server_hostname while using proxy
- Detected by Twitter HOT 1
- Invalid image content when making request with use_stealth=True HOT 1
- CF blocks when using docker container HOT 2
- Is it possible to integrate custom scraping task in a class? HOT 1
- add features for scraper with the use of the ai
- Add option to disable folder making HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from botasaurus.