Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67441

r getting values from children class while web scrapping

$
0
0

I want to get list of Phase state from site. I make such code:

library("rvest") 
library("magrittr")

url <- 'https://energybase.ru/en/oil-gas-field/index'

read_html(url) %>% 
        html_nodes(".info")%>% 
             html_children()%>% 
                  html_children()

and I got:

 [1] <small>City</small>
 [2] <div class="value">Игарка</div>
 [3] <small>Phase state</small>
 [4] <div class="value">нефтегазовое</div>
 [5] <small>Извлекаемые запасы A+B1+B2+C1</small>
 [6] <div class="value">479.10 mln. tons</div>
 [7] <small>City</small>
 [8] <div class="value">Тазовский</div>
 [9] <small>Phase state</small>
[10] <div class="value">газонефтяное</div>
[11] <small>Извлекаемые запасы A+B1+B2+C1</small>
[12] <div class="value">422.00 mln. tons</div>
[13] <small>City</small>
[14] <div class="value">Лянтор</div>
[15] <small>Phase state</small>
[16] <div class="value">нефтегазоконденсатное</div>
[17] <small>Извлекаемые запасы A+B1+B2+C1</small>
[18] <div class="value">380.00 mln. tons</div>
[19] <small>City</small>
[20] <div class="value">Тобольск</div>

I want to get all notes after

<div class="value">

the result should be:

нефтегазовое
газонефтяное
нефтегазоконденсатное

and so on. What function should I use to solve my problem?


Viewing all articles
Browse latest Browse all 67441

Trending Articles