首页 > 解决方案 > R 到网络抓取 - 使用 rvest - 超时错误

问题描述

library(rvest)
 jobbank <- read_html("https://www.jobbank.gc.ca/LMI_bulletin.do?cid=3373&AREA=0007&INDUSTRYCD=&EVENTCD=")

open.connection(x, "rb") 中的错误:已达到超时:连接在 10015 毫秒后超时

jobbank %>%
  html_node(".lmiBox") %>%
   html_text()

eval 中的错误(lhs,父级,父级):找不到对象“jobbank”

我正在尝试从网站的新闻部分查找关键字,但它似乎向我显示了这 2 条错误消息。

标签: r

解决方案


似乎在我这边工作得很好。


library(rvest)
#> Loading required package: xml2
library(stringr)
jobbank <- read_html("https://www.jobbank.gc.ca/LMI_bulletin.do?cid=3373&AREA=0007&INDUSTRYCD=&EVENTCD=")

jobbank %>%
  html_node(".lmiBox") %>%
  html_text() %>%
  str_split("(\r\\n+\\s+)|(\\n\\s+)")
#> [[1]]
#>  [1] ""                                                                                                                                                                                                                                               
#>  [2] "Week of Jan 14 - Jan 18, 2019Lowe's Canada is looking to hire about 2,650 full-time, part-time and seasonal staff at its stores in Ontario. The company will hold a National Hiring Day on February 23."                                        
#>  [3] "The Ministry of Innovation, Science, and Economic Development announced $5M in funding to support automotive innovation at APAG Elektronik Corp. and Service Mold + Aerospace Inc. in Windsor, creating 160 jobs"                               
#>  [4] "A $1M investment by the provincial government into Kenora's Downtown Revitalization Project for a plaza and infrastructure upgrades will create 75 new jobs"                                                                                    
#>  [5] "Redfin Corp., an American real estate brokerage, is expanding into Canada and hiring in Toronto"                                                                                                                                                
#>  [6] "The construction of townhomes at Walkerville Stones in Windsor is expected to begin this spring "                                                                                                                                               
#>  [7] "The Ontario Emerging Jobs Institute (OEJI) at the Nav Centre in Cornwall opened. The OEJI provides skills training in areas with worker shortages."                                                                                             
#>  [8] "The Chartwell Meadowbrook Retirement Residence in Lively broke ground on their expansion project, which includes 41 new suites and 14 town homes"                                                                                               
#>  [9] "Lambton College created an Information Technology and Communication Research Centre using a five-year, $2M grant from the Natural Sciences and Engineering Research Council of Canada. They hope to use part of the funding to employ students."
#> [10] "SnapCab, a workspace pod manufacturer in Kingston, has grown from 20 to 25 employees with more hiring expected to occur in 2019"                                                                                                                
#> [11] "Niagara Pallet & Recyclers Ltd., a manufacturer of pallets and shipping materials in Smithville, is hiring general labour workers, AZ and DZ drivers, production staff, forklift drivers and saw operators"                                     
#> [12] "A1 Demolition will begin demolition of the former Maliboo Club in Simcoe. The plan is to rebuild the structure with residential and commercial space."                                                                                          
#> [13] "MidiCi: The Neapolitan Pizza Co., Sweet Jesus, La Carnita and The Pie Commission will be among several restaurants opening in the 34,000-sq.-ft. Food District in Mississauga this spring "                                                     
#> [14] "Menkes Developments Ltd., in partnership with TD Greystone Asset Management, will renovate the former Canada Permanent Trust Building in Toronto. Work on the 270,000-sq.-ft. space is expected to take between 12 and 18 months."              
#> [15] "Westmount Signs & Printing in Waterloo is hiring experienced installers after doubling the size of its workforce to 24 employees in the last year and a half"                                                                                   
#> [16] "Microbrewery, Heral Haus Brewing Co. opened in Stratford at the end of December"                                                                                                                                                                
#> [17] "Demolition is expected to start this month on Windsor's old City Hall and is expected to be complete by August"                                                                                                                                 
#> [18] "Urban Planet, a clothing store, will open as early as February 2019 at the Cornwall Square mall in Cornwall"                                                                                                                                    
#> [19] "The federal government committed $3.5M towards the construction of a new art gallery in Thunder Bay, bringing total government funding for the project to $27.5M"                                                                               
#> [20] "The Rec Room, a 44,000-sq.-ft. entertainment complex by Cineplex Entertainment LP, is scheduled to open in Mississauga in March "                                                                                                               
#> [21] "Yang Teashop opened a second location in Toronto with plans to open two more locations in the Greater Toronto Area"                                                                                                                             
#> [22] "Spacecraft Brewery opened in Sudbury"                                                                                                                                                                                                           
#> [23] "The Town of Lakeshore will be accepting applications for 11 summer student positions until March 1"                                                                                                                                             
#> [24] "Virtual reality arcade Cntrl V opened in Lindsay"                                                                                                                                                                                               
#> [25] "A new restaurant, Presqu'ile Café and Burger, opened in Brighton"                                                                                                                                                                               
#> [26] "Beauty brand Morphe LLC opened a store in Mississauga"                                                                                                                                                                                          
#> [27] "Footwear retailer Brown Shoe Company of Canada Ltd. Inc. will open an outlet store in Halton Hills in April"                                                                                                                                    
#> [28] "The Westdale Theatre in Hamilton is scheduled to reopen in February "                                                                                                                                                                           
#> [29] "Early ON/Family Grouping will open a child care centre in Monkton"                                                                                                                                                                              
#> [30] "The De Novo addiction treatment centre opened in Huntsville "                                                                                                                                                                                   
#> [31] "French Revolution Bakery & Crêperie opened in Dundas"                                                                                                                                                                                           
#> [32] "A Williams Fresh Cafe is slated to open in Stoney Creek, one of three new locations opening this year in southwestern Ontario"                                                                                                                  
#> [33] "Monigram Coffee Midtown cafe will open in Kitchener this winter "                                                                                                                                                                               
#> [34] "My Roti Place opened a fourth restaurant in Toronto"                                                                                                                                                                                            
#> [35] "A Gangster Cheese restaurant opened in Whitby"                                                                                                                                                                                                  
#> [36] "A Copper Branch restaurant opened in Mississauga "                                                                                                                                                                                              
#> [37] "Hallmark Canada will exit about 20 company-owned stores across Canada in 2019 by either transitioning them to independent ownership or closing them. The loacations of the affected stores have not been identified."                           
#> [38] "Lush Cosmetics at the Intercity Shopping Centre in Thunder Bay will close at the end of January"                                                                                                                                                
#> [39] ""

reprex 包(v0.2.1)于 2019 年 1 月 28 日创建


推荐阅读