Skip to content

Instantly share code, notes, and snippets.

@sajjadmd
Created September 11, 2019 15:11
Show Gist options
  • Select an option

  • Save sajjadmd/48d9c744cb20cb8380e50a08d2cf1ae4 to your computer and use it in GitHub Desktop.

Select an option

Save sajjadmd/48d9c744cb20cb8380e50a08d2cf1ae4 to your computer and use it in GitHub Desktop.
SEO script, extract SERP bold keywords.
(function() {
clear();
const words = [];
function uniq(value, index, self) {
return self.indexOf(value) === index;
}
let selector = `#search em`;
const found = document.querySelectorAll(selector);
if (found.length > 0) {
found.forEach((f) => {
let text = f.textContent;
if (text) {
words.push(text);
}
});
}
console.log("%cLOWER CASE", "font-size:14px;font-weight:bold");
console.log(words.map(v => v.toLowerCase()).filter(uniq).join("\n"));
console.log("%cALL", "font-size:14px;font-weight:bold;");
console.log(words.filter(uniq).join("\n"));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment