Skip to content

Instantly share code, notes, and snippets.

@corbindavenport
Created October 23, 2025 05:50
Show Gist options
  • Select an option

  • Save corbindavenport/f5835e4913833bc87ef14d8568de5f4b to your computer and use it in GitHub Desktop.

Select an option

Save corbindavenport/f5835e4913833bc87ef14d8568de5f4b to your computer and use it in GitHub Desktop.
Data scraper for Google search results
// This can run in the Console on a Google search result page, saving each link with a title, URL, and dates in two formats
var list = {};
document.querySelectorAll('#search a:not(.SP6Rje)' ).forEach(function (el) {
var isoDate;
var name = el.innerText.split("\n")[0];
var date = el.parentElement.parentElement.parentElement.parentElement.parentElement.querySelectorAll('.YrbPuc')[0]?.innerText?.split(' —')[0];
var dateObj = new Date(date);
try {
isoDate = dateObj.toISOString();
} catch {
isoDate = undefined;
}
list[name] = {
'name': name,
'url': el.href,
'date': date,
'isoDate': isoDate
};
});
console.log(list);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment