Skip to content

Instantly share code, notes, and snippets.

@itsmnthn
Last active January 18, 2024 11:29
Show Gist options
  • Save itsmnthn/80d9cc543555763d1bd76d7a30f540d7 to your computer and use it in GitHub Desktop.
Save itsmnthn/80d9cc543555763d1bd76d7a30f540d7 to your computer and use it in GitHub Desktop.
Linkedin Feed Post liker
/**
* @author Manthankumar Satani <satanimanthan@gmail.com>
* @version 1.5.0
*/
/** Interval enough to like 6 to 10 post per minute */
const batchInterval = 60000
const random = true
const waitBetweenLikes = true
async function run() {
let likes = 0
async function startLiking() {
/** window.scrollTo(0, height); */
/** height += incrHeight; */
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}
function like(btn) {
btn.scrollIntoView()
btn.click()
likes += 1
}
const likeButtons = document.querySelectorAll('button[aria-pressed="false"]')
for (const btn of likeButtons) {
/** Randomly like instead of all posts */
if (random) {
if (Math.floor(Math.random() * 2) + 1 === 1)
like(btn)
}
else {
like(btn)
}
if (waitBetweenLikes)
await sleep(Math.floor(Math.random() * 10000))
}
// eslint-disable-next-line no-console
console.log('Liked', likes)
}
startLiking()
setInterval(startLiking, batchInterval)
}
run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment