Function to scrape housing data from a given craiglist url
scraper(url, online = FALSE)
url | The given Craiglist url to scrape the data from. |
---|---|
online | Whether the data is scraped directly from the url online (default = False). False means the data is scraped from a local HTML file. |
tibble A tibble containing listing information such as listing url, price, and house type
url <- "https://vancouver.craigslist.org/d/apartments-housing-for-rent/search/apa" scraper(url = url, online = FALSE)#> # A tibble: 120 x 3 #> listing_url price house_type #> <chr> <chr> <chr> #> 1 https://vancouver.craigslist.org/bnc/apa/d/burnaby-must-s~ $1,250 1br-600ft2- #> 2 https://vancouver.craigslist.org/rds/apa/d/surrey-bedroom~ $1,300 2br- #> 3 https://vancouver.craigslist.org/van/apa/d/vancouver-furn~ $1,850 1br-500ft2- #> 4 https://vancouver.craigslist.org/van/apa/d/vancouver-yale~ $3,695 2br-900ft2- #> 5 https://vancouver.craigslist.org/van/apa/d/vancouver-bed-~ $2,390 2br-748ft2- #> 6 https://vancouver.craigslist.org/van/apa/d/cozy-bedroom-a~ $1,675 1br-500ft2- #> 7 https://vancouver.craigslist.org/van/apa/d/vancouver-br-b~ $1,700 3br- #> 8 https://vancouver.craigslist.org/rds/apa/d/surrey-inner-n~ $950 1br- #> 9 https://vancouver.craigslist.org/rch/apa/d/richmond-bed-1~ $1,850 2br-1200ft~ #> 10 https://vancouver.craigslist.org/van/apa/d/vancouver-big-~ $2,600 2br-935ft2- #> # ... with 110 more rows