Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

read_html for vector element and for character

$
0
0

I have vector of URLs, from where I need to get some text.

I use rvest and this code:

r <- getURL(queries[2])

pages_data <- read_html(r) %>% 
  html_nodes(".bloko-button.HH-Pager-Control") %>%
  html_text()

In this case I get:

character(0)

But if I will put character string instead of vector element it will work.

url <- "https://kazan.hh.ru/search/vacancy?L_is_autosearch=false&area=2&clusters=true&enable_snippets=true&no_magic=true&only_with_salary=true&search_field=name&text=продавец-консультант"
r <- getURL(url)

pages_data <- read_html(r) %>% 
  html_nodes(".bloko-button.HH-Pager-Control") %>%
  html_text()
[1] "2""3""4""5""74""дальше"

But queries[2] == url is TRUE. What's the problem?

Function to get queries:

start_url <- "https://kazan.hh.ru/search/vacancy?L_is_autosearch=false&area=2&clusters=true&enable_snippets=true&no_magic=true&only_with_salary=true&search_field=name"
professions <- c("frontend", "продавец-консультант", "менеджер+по+персоналу", "слесарь")

queries <- str_c(start_url, "&text=", professions)

Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>