Skip to content

Instantly share code, notes, and snippets.

@Asikur22
Created February 22, 2025 16:23
Show Gist options
  • Save Asikur22/b26c9b785cde284e6064527dfc177c11 to your computer and use it in GitHub Desktop.
Save Asikur22/b26c9b785cde284e6064527dfc177c11 to your computer and use it in GitHub Desktop.
WhatsApp Script to Download Images from Browser
// Download All images with click after 3 Seconds
let checkboxes = document.querySelectorAll('[role="button"][title^="Download"]');
let index = 0;
function clickNextCheckbox() {
if (index < checkboxes.length) {
checkboxes[index].click();
console.log(`Clicked checkbox ${index + 1}`);
index++;
setTimeout(clickNextCheckbox, 3000); // Wait 3 seconds before clicking the next one
} else {
console.log("All checkboxes clicked!");
}
}
clickNextCheckbox();
// Download All images with click after 2 Seconds
let allCheckboxes = document.querySelectorAll('[role="button"][title^="Download"]');
// Filter out checkboxes that are inside elements containing an audio download icon
let filteredCheckboxes = Array.from(allCheckboxes).filter(checkbox =>
checkbox.closest('div').querySelector('[data-icon="audio-download"]')
);
let index = 0;
function clickNextCheckbox() {
if (index < filteredCheckboxes.length) {
filteredCheckboxes[index].click();
console.log(`Clicked checkbox ${index + 1}`);
index++;
setTimeout(clickNextCheckbox, 2000); // Wait 2 seconds before clicking the next one
} else {
console.log("All checkboxes clicked!");
}
}
clickNextCheckbox();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment