Skip to content

Instantly share code, notes, and snippets.

@fajela
Last active February 19, 2020 17:40
Show Gist options
  • Save fajela/b03d3a584b3512a710109109508af02e to your computer and use it in GitHub Desktop.
Save fajela/b03d3a584b3512a710109109508af02e to your computer and use it in GitHub Desktop.
SEO Script. Get all the People Also Ask questions from the SERP.
(function() {
clear();
let words = [];
function uniq(value, index, self) {
return self.indexOf(value) === index;
}
let selector = 'g-accordion-expander > div:first-child div';
const found = document.querySelectorAll(selector);
if (found.length > 0) {
found.forEach((f) => {
let text = f.textContent;
if (text) {
words.push(text);
}
});
}
words = words.filter(uniq);
console.log(words.join("\n"));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment