'javascript scraping with Cross-Origin Request Blocked problem
I'm trying to scrape data from a website by sending xhr(XMLHttpRequest) from browser itself from Firefox Devtools but i always get the following error of course i don't have access to the server I'm trying to get the response of my requests and the code is a get code that site triggers by a button here is the code i use in console:
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://i.instagram.com/api/v1/media/2624924054824738183/comments/?can_support_threading=true&min_id={"server_cursor": "QVFBZTYyanpWOFJ1ZU9KeUtSeWVVNnhtZXV0ajI3bFZKRnI2aDNMNHo1OUxKcExEdVkyeDRSU2lYYXM4MUVCbUVyMDROcTEtbE9KUEJNS3I4bWZ1dVVBdWRfZzYwS1dLUWc4OXNPOWlMMExhQXc=", "is_server_cursor_inverse": true}');
xhr.setRequestHeader('User-Agent', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0');
xhr.setRequestHeader('Accept', '*/*');
xhr.setRequestHeader('Accept-Language', 'en-US,en;q=0.5');
xhr.setRequestHeader('X-IG-App-ID', '936619743392459');
xhr.setRequestHeader('X-ASBD-ID', '198387');
xhr.setRequestHeader('X-IG-WWW-Claim', 'hmac.AR28NCc9EqpWszE6HH3u0kqIsH_2lC5Ph4NKgFGrbxFwviKw');
xhr.send();
and the error i get is :
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
