35 minutes ago · Tech · hide · 0 comments

I wanted to find the number of citations per year for a paper from my dad, at least per Google Scholar. Hacking around, here’s a little JavaScript to get it per results page: function extract(resultNode) { const titleElem = resultNode.querySelector(".gs_rt"); const titleLink = titleElem.querySelector("a"); let title = ""; let url = ""; let authors = ""; let year = ""; let publisher = ""; if (titleLink) { title = titleLink.textContent; url = titleLink.href; } else { title = titleElem.querySelector("span[id]").textContent; } const authorDateString = resultNode.querySelector(".gs_a").textContent; const authorDateMatch = /^(.+)\s-\s[^-]*\s*(\d{4})\s-\s([^-]+)/.exec(authorDateString); if (authorDateMatch) { authors = authorDateMatch[1]; year = authorDateMatch[2]; publisher = authorDateMatch[3]; } else { console.log("Didn't get author date match", authorDateString); const authorMatch = /^(.+)\s-\s([^-]+)/.exec(authorDateString); if (authorMatch) { authors = authorMatch[1]; publisher =…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.