Skip to content

Instantly share code, notes, and snippets.

@ricealexander
Created April 3, 2020 18:49
Show Gist options
  • Save ricealexander/289bc6f9fe4820cbb118360871f13795 to your computer and use it in GitHub Desktop.
Save ricealexander/289bc6f9fe4820cbb118360871f13795 to your computer and use it in GitHub Desktop.
Remove promoted content on different platforms
// Remove Twitter Promoted Tweets
window.addEventListener('scroll', _event => {
[ ...document.querySelectorAll('h2') ]
.filter(heading => heading.textContent.includes("Promoted Tweet"))
.map(heading => heading.parentElement.parentElement)
.forEach(promotion => promotion.remove())
})
// Remove LinkedIn Promoted Posts
window.addEventListener('scroll', _event => {
[ ...document.querySelectorAll('span') ]
.filter(span => span.textContent.includes("Promoted"))
.map(span => span.closest('.ember-view'))
.forEach(promotion => promotion.remove())
})
// Remove Reddit Promoted Posts
window.addEventListener('scroll', _event => {
[ ...document.querySelectorAll('span') ]
.filter(span => span.textContent.includes("promoted"))
.map(span => span.closest('[tabindex]'))
.forEach(promotion => promotion.remove())
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment