urlfilter provides wrong number

5 visualizaciones (últimos 30 días)
Andreas Neul
Andreas Neul el 3 de Mzo. de 2020
Comentada: Andreas Neul el 4 de Mzo. de 2020
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?

Respuesta aceptada

Vinod
Vinod el 4 de Mzo. de 2020
Editada: Vinod el 4 de Mzo. de 2020
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 comentario
Andreas Neul
Andreas Neul el 4 de Mzo. de 2020
Yep, this works! Many thanks, Vinod!

Iniciar sesión para comentar.

Más respuestas (0)

Comunidades de usuarios

Más respuestas en  ThingSpeak Community

Categorías

Más información sobre ThingSpeak en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by