我正在尝试从Yahoo Finance(例如https://finance.yahoo.com/quote/IGE/history?period1=1006729200&period2=1195081200&interval=1wk&filter=history&frequency=1wk)中获取股价数据。问题在于该页面通过主动向下滚动来动态加载。
webread()函数似乎无法在网页中执行Javascript。
是否有解决此问题的简便方法?
非常感谢
我找不到适用于webread()函数或其他函数的有用选项。
historicalPriceFile = webread("https://finance.yahoo.com/quote/IGE/history?period1=1006729200&period2=1195081200&interval=1d&filter=history&frequency=1d");
% Extracting the date field to a cell array of cells.
% regexp(str,expr,'outkey') is used for matching regex. Outkey 'tokens' (portions of matched text corresponding
% to portions of regex) is to have the text of each captured token stored in historicalPriceFile.
% To create tokens, enclose part of the regular expression in parentheses.
dateField = regexp(historicalPriceFile,'<span data-reactid="\d+">(\w)+\s(\d)+[\,]\s(\d)+</span>',"tokens");
输出dateField和numField是1x100数组,而滚动到底部后总共为1504行。