필터 지우기
필터 지우기

Extract data from a web page

조회 수: 19 (최근 30일)
Dimitrios Poulos
Dimitrios Poulos 2021년 10월 23일
댓글: Image Analyst 2021년 10월 24일
I want to extract a specific number from a web page. To be more accurate the number 74. It is the cloud coverage from Windy page. This information exist in the following image at the tab elements but my code is extracting more ....general information(attachment). How I could extract this specific info from tab ''elements'' in chrome browser?
In the attachment there is my result from the following code but 74 does not exist. :-(
url = char(strcat({'https://www.windy.com/?clouds,2021-10-27-11,'},{MitraN},{','},{MitraE},{',8,d:picker'}));
options = weboptions('CertificateFilename','');
A1 = webread(url,options)

답변 (1개)

Image Analyst
Image Analyst 2021년 10월 23일
Try turning that imcomprehensible mess of XML into an organized structure with the attached function:
url = char(strcat({'https://www.windy.com/?clouds,2021-10-27-11,'},{MitraN},{','},{MitraE},{',8,d:picker'}));
options = weboptions('CertificateFilename','');
A1 = webread(url,options)
s = xml2struct(A1)
  댓글 수: 2
Image Analyst
Image Analyst 2021년 10월 24일
We can't run your code because you did not define MitraN and MitraE. Tell us what those should be. Give us code that can run!
Image Analyst
Image Analyst 2021년 10월 24일
Why do you think "74" should exist in the returned string?
When you right click on the page and say View Source do you see a 74?
url = char('https://www.windy.com/?clouds,2021-10-27-11,23.1283199987984,-16.0439653616218,8,d:picker');
options = weboptions('CertificateFilename','');
A1 = webread(url,options)
index = strfind(A1, '74')
for k = 1 : 50 : length(A1)
k2 = min(length(A1), k+49);
fprintf('%s\n', A1(k:k2));
end

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

카테고리

Help CenterFile Exchange에서 Structured Data and XML Documents에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by