How to download image blocked by cors

365 Views Asked by At

When I scrape data which includes images from other websites, I encounter the following error:

$.get('https://truyenvua.com/128/1081/1.jpg?gt=hdfgdfg', function (data) { console.log(data) }); An error occurred as follows.

enter image description here

Please help me with the solution

1

There are 1 best solutions below

0
Matt On

The remote domain needs to explicitly allow cross-origin requests for images by adding the appropriate CORS headers to the HTTP response. The fact that they haven't means it's likely that they do not want their images scraped. Their server simply will not return images requested by third party domains.