필터 지우기
필터 지우기

Scraping Yahoo Finance for Earnings data

조회 수: 9 (최근 30일)
David
David 2020년 10월 9일
댓글: David 2020년 11월 7일
I'm trying to scrape Yahoo Finance for earnings data. The address for Apple would be Yahoo Finance AAPL . Using webread and urlread I get returned an info page, but not the data displayed on screen. I'm not sure why this is, the data I want appears in the source code. I only have experience of scraping direct web html pages which are increasingly rare. Can anyone help with this?
Thanks.
  댓글 수: 1
David
David 2020년 11월 7일
Instead of trying to scrape the website which uses Java script I decided on a different approach. The following code opens a CNBC Dow 30 web page, uses Ctrl-A and Ctrl-C to copy the page into clipborad. This is imported into Matlab. Its not fancy, but it works! Make sure you have already run Chrome (or whatever browser you use) as it speeds up the code response time. Data will be in A.
h = actxserver('WScript.Shell');
h.Run('chrome'); %Invokes chrome.exe
pause(5); %Waits for the application to load.
h.AppActivate('chrome'); %Brings chrome to focus
h.SendKeys('https://www.cnbc.com/dow-30/~'); %send web address
pause(5);
h.SendKeys('^a'); % highlight file
pause(2)
h.SendKeys('^c'); % copy file
pause(3)
A = importdata('-pastespecial'); %import formatted data
pause(3)
h.SendKeys('%{F4}'); %close chrome

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Web Services에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by