Scraping with R - xpathSApply returning a list of 0

2

I'm learning to read data in XML in R.

I would like to extract the information of the Brazilian football (name of the championship, game principal, result, etc.) of this site: link with the XML package. My code looks like this:

[1] fileUrl <- 'http://www.terra.com.br/esportes/equipes/sao-paulo/lista-de-jogos'
[2] doc <- htmlTreeParse(fileUrl, useInternalNodes = T)
[3] championship <- xpathSApply(doc,"//h3[@class='header-matches']", xmlValue)

However, the xpathSApply function ends up returning a list of 0. Does anyone know why?

I tested the code on the Globo Sports website and I was successful, I imagine it has to do with the XML code itself on Terra's site.

    
asked by anonymous 02.11.2017 / 13:01

0 answers