user1731038
user1731038

Reputation: 35

R - web scraping date picker

I'm trying to use R to web scrape stock data from here https://markets.ft.com/data/equities/tearsheet/historical?s=RICHTER:BUD, but I don't know how to change the date range.

I'm using rvest::html_form, but I was not able to even identify which form should I alter and also wasn't able to set_values of any form on the webpage.

I'd be grateful if someone just could show some guidelines.

Many thanks

Upvotes: 0

Views: 757

Answers (1)

msaltieri
msaltieri

Reputation: 172

It's pretty simple because the website seems to accept parameters inside the URL. Then, with respect to the example you posted, if you want to retrieve data between - let's say - January 1st 2017 and June 30th 2017, you could easily fetch the following url:

https://markets.ft.com/data/equities/ajax/get-historical-prices?startDate=2017%2F01%2F01&endDate=2017%2F06%2F30&symbol=136642

where symbol=136642 stands for the RICHTER:BUD ticker, as you could find through a GET command on the original URL.

Hope it helps!

Upvotes: 1

Related Questions