Skip to content

Instantly share code, notes, and snippets.

@maksii
Created November 30, 2024 09:11
Show Gist options
  • Save maksii/56d7bb5ebc68dfd30683cad7d59a0d34 to your computer and use it in GitHub Desktop.
Save maksii/56d7bb5ebc68dfd30683cad7d59a0d34 to your computer and use it in GitHub Desktop.
// donwload full page from https://toloka.to/tracker.php?nm=
// Function to simulate clicks with a delay
async function clickAndDownload() {
// Select all anchor elements with the specified class and href pattern
const downloadLinks = Array.from(document.querySelectorAll('a.genmed[href^="download.php?id="]'));
for (let i = 0; i < downloadLinks.length; i++) {
const link = downloadLinks[i];
// Simulate a click on the link
link.click();
console.log(`Clicked link ${i + 1} of ${downloadLinks.length}: ${link.href}`);
// Wait for 1 second before clicking the next link
await new Promise(resolve => setTimeout(resolve, 500));
}
console.log("All download links have been clicked.");
}
// Run the function
clickAndDownload();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment