I can't get my head around this problem in R and I would really appreciate if you could leave a piece of advice for me here.
I am trying to scrape historical bond yield data from https://www.investing.com/rates-bonds/spain-5-year-bond-yield-historical-data for personal use only (of course).
The solution provided here works really well but only goes as far as to scrape the first 24 time stamps of daily data: webscraping data tables and data from a web page
What I am trying to achieve is to change the date range in order to scrape more historical data.
Based on the SelectorGadget tool, the input form id for the date range is called //*[(@id = "widgetFieldDateRange")]
I have also tried using the following lines of code to change the date values but without success:
library(rvest)
url1 <- "https://www.investing.com/rates-bonds/spain-5-year-bond-yield-historical-data" #Spain 5yr yield
session <- html_session(url1)
pgform <- html_form(session)[[1]]
pgform$fields[[3]]$value <- "01/01/2010 - 09/10/2020"
result <- submit_form(session, pgform)
Question: Any idea how to submit the new date range correctly and retrieve the extended time series?
Thank you very much in advance for your help!
PS: Unfortunately, the URL does not change based on the date range.