Last active
August 24, 2022 06:29
-
-
Save akshar-dave/e2bad22e7fef33104262b6214feff1b8 to your computer and use it in GitHub Desktop.
Block LinkedIn posts with a specific hashtag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let hashtag = "MIDJOURNEY"; | |
const removePostsWithHashtag = (posts, hashtag) => { | |
let docs = posts; | |
docs.forEach((doc => { | |
let caption = doc.innerText.toUpperCase(); | |
let hasHashtag = caption.indexOf(hashtag) !== -1 | |
if(!hasHashtag) return; | |
let thisPost = doc.closest(".artdeco-card"); | |
thisPost.remove(); | |
console.log(`Removed post with hashtag ${hashtag}: ${caption}`); | |
})); | |
} | |
setInterval(()=>{ | |
let docs = document.querySelectorAll('.feed-shared-update-v2__commentary'); | |
removePostsWithHashtag(docs, hashtag) | |
}, 2000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment