我在该页面的源代码中搜索了“过期”,并查看了 URL 是如何形成的。添加&expiryDates
而不是#expiry
导致更易于解析的表。
library(RCurl)
library(XML)
Canola <- "https://www.theice.com/productguide/ProductSpec.shtml?specId=251&expiryDates"
WS <- getURL(Canola)
x <- readHTMLTable(WS, stringsAsFactors=FALSE)
as.data.frame(lapply(x[[1]], as.Date, format="%a %b %d %X"))
# Contract.Symbol FTD LTD FND LND FDD LDD Options.FTD Options.LTD
#1 2013-07-01 2013-05-16 2013-07-12 2013-06-28 2013-07-15 2013-07-02 2013-07-16 <NA> 2013-06-21
#2 2013-08-01 2013-03-25 2013-07-26 2013-07-31 2013-08-15 2013-08-01 2013-08-16 <NA> 2013-07-26
#3 2013-09-01 2013-08-27 2013-08-23 2013-08-30 2013-09-16 2013-09-03 2013-09-17 <NA> 2013-08-23
#4 2013-10-01 2013-05-27 2013-09-20 2013-09-30 2013-10-15 2013-10-01 2013-10-16 <NA> 2013-09-20
#5 2013-11-01 2013-07-15 2013-11-14 2013-10-31 2013-11-15 2013-11-01 2013-11-18 <NA> 2013-10-25
#6 2013-01-01 2013-11-15 2013-01-14 2013-12-31 2013-01-15 2013-01-02 2013-01-16 <NA> 2013-12-20
#7 2013-03-01 2013-01-17 2013-03-14 2013-02-28 2013-03-17 2013-03-03 2013-03-18 <NA> 2013-02-21
#8 2013-05-01 2013-03-15 2013-05-14 2013-04-30 2013-05-15 2013-05-01 2013-05-16 <NA> 2013-04-25
#9 2013-07-01 2013-05-15 2013-07-14 2013-06-30 2013-07-15 2013-07-02 2013-07-16 <NA> 2013-06-20
#10 2013-11-01 2013-07-16 2013-11-14 2013-10-31 2013-11-17 2013-11-03 2013-11-18 <NA> 2013-10-24
#11 2013-01-01 2013-11-15 2013-01-14 2013-12-31 2013-01-15 2013-01-02 2013-01-16 <NA> 2013-12-19
#12 2013-03-01 2013-01-15 2013-03-13 2013-02-27 2013-03-16 2013-03-02 2013-03-17 <NA> 2013-02-20
#13 2013-05-01 2013-03-15 2013-05-14 2013-04-30 2013-05-15 2013-05-01 2013-05-19 <NA> 2013-04-24
#14 2013-07-01 2013-05-15 2013-07-14 2013-06-30 2013-07-15 2013-07-02 2013-07-16 <NA> 2013-06-26
编辑:更多关于我如何找到上面使用的 URL。我实际上没有使用任何开发人员工具。我只是右键单击并选择“查看源代码”并搜索“到期”。有一个app.urls
部分有这样的东西
'expiry':'/productguide/ProductSpec.shtml;jsessionid=C59BE223F113CFDD340BF23CC07EEFFC?expiryDates=&specId=251'
所以,我尝试省略 jsessionid 部分,然后我去了
https://theice.com/productguide/ProductSpec.shtml?expiryDates=&specId=251
它看起来很有趣。我只将它重新排序为https://www.theice.com/productguide/ProductSpec.shtml?specId=251&expiryDates
因为我认为这样的 URL 看起来更好。