Skip to content

Instantly share code, notes, and snippets.

@udaragangabadage
Created June 29, 2022 05:33
Show Gist options
  • Save udaragangabadage/b09b1608ae6009ab16e91046ec0d1857 to your computer and use it in GitHub Desktop.
Save udaragangabadage/b09b1608ae6009ab16e91046ec0d1857 to your computer and use it in GitHub Desktop.
To determine the number of "likes," change the first line where j < 9 to whatever number you're aiming for. Very helpful when following a hashtag or after searching for a particular term.
for(var j = 1; j < 9; j++) {
for (const d of document.querySelectorAll('div[data-testid="like"]')) {
d.scrollIntoView(true);
d.click()
}}
If you are trying to 'unlike' instead of 'like' just change line 2:
for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment