urlfilter provides wrong number

조회 수: 1 (최근 30일)
Andreas Neul
Andreas Neul 2020년 3월 3일
댓글: Andreas Neul 2020년 3월 4일
Hi,
I am experimenting with ThingSpeak App creation. I am using
url = 'https://www.worldometers.info/world-population/';
filteredData = urlfilter(url,'Germany');
display(filteredData,'Germany');
I get this response:
Germany = 19
instead of the currently correct response of 83697339.
How do I need to modify above code so that I get the correct number?

채택된 답변

Vinod
Vinod 2020년 3월 4일
편집: Vinod 2020년 3월 4일
It appears that the website loads its data dynamically (i.e., data is loaded into the page's DOM asynchronously after the initial page is loaded). You will have to scrape it from the page that is loaded when you click "Germany". Try:
url = 'https://www.worldometers.info/world-population/germany-population/';
populationDE = urlfilter(url,'The current population of <strong>Germany</strong> is')
  댓글 수: 1
Andreas Neul
Andreas Neul 2020년 3월 4일
Yep, this works! Many thanks, Vinod!

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

추가 답변 (0개)

커뮤니티

더 많은 답변 보기:  ThingSpeak 커뮤니티

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by