Created
October 23, 2025 05:50
-
-
Save corbindavenport/f5835e4913833bc87ef14d8568de5f4b to your computer and use it in GitHub Desktop.
Data scraper for Google search results
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
| // 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