Skip to content

Instantly share code, notes, and snippets.

@akshar-dave
Last active August 24, 2022 06:29
Show Gist options
  • Save akshar-dave/e2bad22e7fef33104262b6214feff1b8 to your computer and use it in GitHub Desktop.
Save akshar-dave/e2bad22e7fef33104262b6214feff1b8 to your computer and use it in GitHub Desktop.
Block LinkedIn posts with a specific hashtag
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