从网页中提取餐馆的名称

时间:2015-05-27 13:37:50

标签: r web-scraping

我只能得到第一家餐馆的名称,即#34; toit"使用这些命令:

self.itemDescription?.setContentCompressionResistancePriority(UILayoutPriority.Required, forAxis: .Vertical);

如何调整此项以从网页中提取所有餐馆名称?

1 个答案:

答案 0 :(得分:3)

您需要使用html_nodes而不是html_node

    url %>% html_nodes("li a.result-title") %>% html_text()

 [1] "Toit "                              "Truffles "                          "Church Street Social "             
 [4] "AB's - Absolute Barbecues "         "Onesta "                            "The Black Pearl "                  
 [7] "The Hole in the Wall Cafe "         "Arbor Brewing Company "             "Big Brewsky "                      
[10] "Chutney Chang "                     "Soho St. "                          "Glen's Bakehouse "                 
[13] "Fenny's Lounge And Kitchen "        "SodaBottleOpenerWala "              "The Black Rabbit "                 
[16] "High Ultra Lounge "                 "Prost Brew Pub "                    "LOFT38 "                           
[19] "Windmills Craftworks "              "Smoke House Deli "                  "Tim Tai "                          
[22] "Vapour Pub & Brewery "              "Big Pitcher "                       "Punjab Grill "                     
[25] "Brewsky "                           "Hard Rock Cafe "                    "The Boozy Griffin "                
[28] "The Glass House - Deli Bistro Bar " "The Fatty Bao - Asian Gastro Bar "  "Monkey Bar "