0

Hi there I am trying to scrape a few tables from this website. https://money.tmx.com/en/quote/DOO/options

I have tried both an xpath and css. It seems that the java script is causing an issue. Here are my attempts

CSS:

library(rvest)
library(tidyverse)
ticker = "DOO"
url = sprintf('https://money.tmx.com/en/quote/%s/options', ticker)
page = read_html(url) %>%html_nodes(css =  "div.options-table-wrap:nth-child(5)")

XPATH:

library(rvest)
library(tidyverse)
ticker = "DOO"
url = sprintf('https://money.tmx.com/en/quote/%s/options', ticker)
page = read_html(url) %>%html_nodes(xpath =  "//*[@id="DataTables_Table_0"]")

Neither of these return anything. Your help would be much appreciated.

4
  • Try using RSelenium or webdriver package, which loads javascripts. On the difference between rvest and the two mentioned packages: stackoverflow.com/questions/57370389/… Commented Mar 25, 2021 at 4:30
  • Rselenium is so slow tho IIRC (lets say i wanted to pull 100 tickers instead of 1) Commented Mar 25, 2021 at 4:38
  • 1
    It is dynamically pulled from one of the requests you can find in network tab beginning with https://app.quotemedia.com/datatool/getOptionQuotes.json - it comes with a copyright warning, Commented Mar 25, 2021 at 5:10
  • okay i will give that a shot thanks @QHarr Commented Mar 26, 2021 at 19:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.