I've been web scraping yahoo finance stock options for a couple of years and I use rvest to do it. I am currently using Rstudio server on ubuntu with no problem. I was working on adding certain features on my macbook pro when i ran into a problem: I would not get the options date data. It works on ubuntu but not on my macbook. I'm running the exact same code and i have the same package version on both machines. On my mac this returns an empty string and on ubuntu i see all the selectors dates (correct information).
library(rvest)
library(dplyr)
url_date <- "https://finance.yahoo.com/quote/SPY/options?p=SPY"
webpage_date <-
read_html(url_date) %>%
html_nodes(".drop-down-selector") %>%
html_text
In Ubuntu these return data but on the macbook they return an empty character vector
webpage_date <-
read_html(url_date) %>%
html_nodes("option") %>%
html_text
webpage_date <-
read_html(url_date) %>%
html_nodes("#Main") %>%
html_text
furthermore, i get different results on both machines when I search for this ID
webpage_date <-
read_html(url_date) %>%
html_nodes("#YDC-Col1")
I'm very confused about the different results.