I am using cheerio for web crawling, I want to get all media link URLs like images or videos or else. Is there any function, object, method which is used to get media links also want to fetch all backlinks of the page
const cherio = require('cherio');
const request = require('request');
const url = "https://www.sdpgroups.com/";
request(url, (err, res, html) => {
try {
if (!err && res.statusCode === 200) {
const $ = cherio.load(html);
// scrapping Images
$("img").each((index, imageElement) => {
const imgUrl = $(imageElement).attr("src");
console.log(imgUrl);
});
} else {
console.log(err)
}
} catch (err) {
console.log(`unhandled error: ${err}`);
}
});