Relative Content

Tag Archive for rweb-scrapingrselenium

Return the year of the first mention of a string in Google using RSelenium

I have a list of strings (slightly over a thousand), and I would like to find out the year when each string was mentioned in the web for the first time and save the link of the webpage where this “oldest” mention was found (and store both in a dataframe). When I had to do this with a much smaller sample, I just did it manually by playing with custom time ranges for my Google searches (i.e. reducing the range until no pages were found). Now I’m trying to use web scraping which I’ve never used before, and together with YouTube and ChatGPT I managed to come up with the following code:

Return the year of the first mention of a string in Google using RSelenium

I have a list of strings (slightly over a thousand), and I would like to find out the year when each string was mentioned in the web for the first time and save the link of the webpage where this “oldest” mention was found (and store both in a dataframe). When I had to do this with a much smaller sample, I just did it manually by playing with custom time ranges for my Google searches (i.e. reducing the range until no pages were found). Now I’m trying to use web scraping which I’ve never used before, and together with YouTube and ChatGPT I managed to come up with the following code: