-
-
Save virgiliu/5f6fc86bb79a3c6d782441167e3ae470 to your computer and use it in GitHub Desktop.
GreaseMonkey/TamperMonkey script to remove spam companies from LinkedIn job search page
This file contains hidden or 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
// ==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