Please I am trying to scrape the keywords of trending topics from the google news website in r studio. I used both the rvest and deplyr packages. I also used selector gadget in google chrome to find the tags for the keywords.
Here is my code below:
library(rvest)
library(dplyr)
google.news<-read_html("https://news.google.com/topstories?hl=en-NG&gl=NG&ceid=NG:en")
google.news %>%
+html_nodes(".boy4he") %>%
+html_text()
But when I run the code, I get the error message:
> google.news<-read_html("https://news.google.com/topstories?hl=en-NG&gl=NG&ceid=NG:en")
> google.news %>%
+ +html_nodes(".boy4he") %>%
+ +html_text()
Error in UseMethod("xml_find_all") :
no applicable method for 'xml_find_all' applied to an object of class "character"
Can somebody please advise me on what could be wrong? Thanks