Web Scrapping MSN Financial analysis

Hi everyone,
I am trying to web scrapping some stocks recommendations listed in the MSN webpage.
I would like to extract the "kaufen" (or whatever the recommendation is) in the webpage.
I got it done using RSelenium, but I want to use rvest way since it runs better in a loop.
The idea is to include a loop iterating over a list of stock names and storing the results for decision making.
My attempts so far returns always "{xml_nodeset (0)}".
Below is the code.
Thank you for any support!

library(dplyr)
library( rvest)
link_stock <- "https://www.msn.com/de-de/finanzen/aktiendetails/fi-apn6hw?ocid=hpmsn"
year_event <- rvest::read_html(link_stock)  %>%
  rvest::html_nodes(".cardBody_content_keyWords_analystic-DS-EntryPoint1-1")  %>%
  html_text()

This is a dynamic webpage, not a static one.
That is why RSelenium might succeed; because it emulates a browser and can construct the page from the javascript; whereas rvest can not.

I recommend that you loop your RSelenium solution

1 Like

Thanks a lot @nirgrahamuk,
now I understand why. The point is that looping over RSelenium returns an error.
I will try again anyways.
I will come back here soon.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.