I am working on web crawling (using axios, cheerio to get html from website)so as per requirement I have to fetch images from all section A,B but issue is due to this images are static.. sometimes section A contain 2 images and sometimes section B contain 3 images.. so requirement is keep section A images in different variable and section B images in different variable. I got stuck here how to do this… no idea how to distinguish this.
<div class="container headingWrapper">
<h3 class="DetailSection_heading ">Section A:</h3>
</div>
<div class="DetailSection_content">
<div class="container">
<div class="css-0">
<div class="row justify-content-center">
<div class="col-lg-6">
<img src="https://img_url_1" alt="" class="DetailSectionImage" data-index="0">
<img src="https://img_url_2" alt="" class="DetailSectionImage" data-index="0">
</div>
</div>
</div>
</div>
</div>
<div class="container headingWrapper">
<h3 class="DetailSection_heading ">Section B:</h3>
</div>
<div class="DetailSection_content">
<div class="container">
<div class="css-0">
<div class="row justify-content-center">
<div class="col-lg-6">
<img src="https://img_url_3" alt="" class="DetailSectionImage" data-index="0">
<img src="https://img_url_4" alt="" class="DetailSectionImage" data-index="0">
</div>
</div>
</div>
</div>
</div>
jquery Code:
const Fetched_imgs = $('div.DetailSection_content img').map(function() {
return $(this).attr("src")
}).get();