I use JavaScript to get the API data from https://aparat.com and I get 'Cross-Origin Request Blocked' error every time. The method I use works for other sites but not for this site and the API file is text and is not json file. Could you please to help me what should i do? Thank you
async function postData(url = '', data = {}) {
const response = await fetch(url, {
method: 'POST',
body: JSON.stringify(data)
});
return response.json();
}
postData('https://www.aparat.com/etc/api/video/videohash/Pua5e', '').then(data => {
console.log(data);
});