Skip to content

Instantly share code, notes, and snippets.

@briankung
Created January 30, 2018 17:25
Show Gist options
  • Save briankung/ecc601f02aa51bd419cc6a013e3f905e to your computer and use it in GitHub Desktop.
Save briankung/ecc601f02aa51bd419cc6a013e3f905e to your computer and use it in GitHub Desktop.
Removes redundant craigslist results from a search based on title
const reducer = (resultTitles, result) => {
let title = result.querySelector('.result-title').innerText
resultTitles.includes(title) ? result.remove() : resultTitles.push(title)
return resultTitles
}
[...document.querySelectorAll('li.result-row')].reduce(reducer, [])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment