I am having a trouble trying to get an img using axios
from an url. The problem is that axios is returning the content before all the data is loaded to the page. I am already using async/await
sintax, but I can't figure out how to make the request wait untill all the data is loaded. For example, using cheerio
to try to get an img
, the result is undefined
due this concept.
Here is my code about getting an url:
async function getUrl(url){
const request = await axios.get(url);
const html = request.data;
const $ = cheerio.load(html);
return $;
}
Is there a way to check if all data is loaded?
The page that I am scraping to get the main img is the following: https://www.saatchiart.com/art/Painting-Goat/313699/2073158/view
Thanks