Skip to content

Instantly share code, notes, and snippets.

@virgiliu
Forked from rigwild/linkedinSpammers.js
Last active December 3, 2020 14:45
Show Gist options
  • Save virgiliu/5f6fc86bb79a3c6d782441167e3ae470 to your computer and use it in GitHub Desktop.
Save virgiliu/5f6fc86bb79a3c6d782441167e3ae470 to your computer and use it in GitHub Desktop.
GreaseMonkey/TamperMonkey script to remove spam companies from LinkedIn job search page
// ==UserScript==
// @name LinkedIn Spammer Remover
// @version 1
// @match https://www.linkedin.com/jobs/*
// @grant none
// ==/UserScript==
// Original author: https://gist.github.com/rigwild/219c20d910da72901e20bc10a6f0411a
const blacklist = new Set([
'Technicus.nl',
'Werkzoeken.nl',
'ICTerGezocht.nl',
])
const removeSpamFromSearchResults = () => {
const listings = Array.from(document.querySelectorAll('li.jobs-search-results__list-item'))
let count = 0
let spammers = new Set()
listings.forEach(x => {
const content = x.querySelector('a[data-control-name="job_card_company_link"]')
if (content && blacklist.has(content.textContent.trim())) {
x.remove()
spammers.add(content.textContent.trim())
count++
}
})
if (count > 0) console.log(`[Remove spam search results] Removed ${count} spam job postings`, spammers)
}
const removeSpamFromRecommendations = () => {
let spamCount = 0;
const spammerImages = document.querySelectorAll('img')
spammerImages.forEach(spamImg => {
if(blacklist.has(spamImg.title.trim()))
{
spamImg.closest('li').remove()
spamCount++
}
})
}
(async () => {
'use strict';
while (true) {
await new Promise(res => setTimeout(res, 800))
removeSpamFromSearchResults()
removeSpamFromRecommendations()
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment