Scroll through images in carousel using Jquery and download the images using curl batch script

 There might be two kinds of carousels.

Carousel type 1 : 

the one in which image tag's src is already loaded with its original image URL. For such carousel just execute below script in browser dev tool's snippet portion.


async function myFunction(){
    var first = "";
    var firstDone = false;
    var lastDone = false;

    while (!lastDone){

        if(first == ($(".photo-container > .photo-controls-wrapper > img").attr("src"))){
            lastDone = true;
            break;
        }
        if(!firstDone){
            first = $(".photo-container > .photo-controls-wrapper > img").attr("src");
            firstDone = !firstDone;
        }
        console.log($(".photo-container > .photo-controls-wrapper > img").attr("src"));
        $(".navigation-button-right").click();
         await sleep(2000);
    }
}

function sleep(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}

myFunction();

Carousel type 2:

In this one the image tag's src would be preloaded and hence we can directly parse through using jQueryscript and print out the src paths.


$("ul.photo-carousel-inner-wrapper").children("li.carousel-images").each(function(index){
    console.log($(this).find("img").attr("src"));
})


put the console printed data in a text file and find and replace the filename.js:lineNumber thing from it.

Create a batch file with below code:

@echo off
setlocal EnableDelayedExpansion
SET /A p = 0
FOR /F %%i in (images.txt) DO (
  curl %%i > o_hotel_images_!p!.jpg
  SET /A p= !p! + 1
)
pause


Put the batch file and the text file containing the image URLs in the same directory. Now execute the bat file by double clicking it.




Comments

  1. I know, deep philosophical things The idea is that anything can be resolved if you have the appropriate attitude. The phrase "all will be well in the end" is common in India. IoT SIM Card

    ReplyDelete
  2. Great tutorial on implementing a scrollable image carousel using HTML, CSS, and JavaScript! Visual content plays a crucial role in keeping users engaged, especially in digital marketing where a seamless user experience is key to driving conversions. Mastering such techniques can significantly improve website performance. Speaking of which, if anyone is looking to deepen their skills in digital marketing, I highly recommend checking out our Best Digital Marketing Course In Noida, which covers everything from web optimization to advanced marketing strategies.

    ReplyDelete

Post a Comment

Popular posts from this blog

Windows phone Wifi connectivity problem.

Create Excel file using Java: Apache POI - PART - 3: Bar Chart