What's wrong with my loop?

Hi All!

I'm trying to create a webscraping tool for propertyfinder, so I have this code chunk below,
but it keeps giving me an error saying "unexpected symbol" on the for loop part. I just don't know where the problem is.

Thanks a lot for the help guys!! Appreciated

get_age <- function(property_link) {
  property_page = read_html(property_link)
  listing_age = property_page %>% html_node(".property-page__legal-list+ .property-page__legal-list .property-page__legal-list-item--value") %>% 
newprop <- data.frame()
for (property_pages in 1:25) {
  link = paste("https://www.propertyfinder.ae/en/search?c=1&cs=off_plan&l=6&ob=mr&page=" 
  page <- read_html(link)
  Property <- page %>% html_nodes(".card__location-text") %>% html_text()
  Price <-  page %>% html_nodes (".card__price-value") %>% html_text ()
  Property_Type <-page %>%  html_nodes(".card__property-amenity--property-type") %>% html_text()
  Area <- page %>%  html_nodes(".card__property-amenity--area") %>% html_text()
  Description <- page %>% html_nodes (".card__property-title-payment-plan span , .card__title-link") %>%      html_text()
  Bedroom <- page %>% html_nodes (".card__property-amenity--bedrooms") %>% html_text()
  Bathroom <- page %>%  html_nodes(".card__property-amenity--bathrooms") %>% html_text()
  list_age <- sapply(url, FUN = get_age, USE.NAMES = FALSE)  
  newprop <- rbind(data.framedata.frame(Property, Property_Type, Price, Area,
                   Bedroom, Bathroom,list_age, Description, url, stringASFactors = FALSE))

print(paste("Page:", page_result))


Are you missing a comma before property_pages?

Hi thanks, the whole code now works but now it's giving me an error "http error 400". I'll try to figure this out.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.