【发布时间】:2019-10-28 15:27:50
【问题描述】:
我想从搜索框中获取输出的 URL 链接。 例如,如果我在https://www.realestate.co.nz/profile/ 的搜索框中输入“4/271 Balmoral Road”,它会显示相关结果并引导我转到https://www.realestate.co.nz/profile/0b27093b9ce641108f7a6033b9fdae28
所以在 R 中,如果我将“4/271 Balmoral Road”作为输入,我希望输出为“https://www.realestate.co.nz/profile/0b27093b9ce641108f7a6033b9fdae28”
你能帮帮我吗?那将不胜感激。
我在下面的代码中使用了 Rvest,但没有用
'https://www.realestate.co.nz/profile?query=4/271%20Balmoral%20Road' %>%
read_html() %>%
html_nodes(xpath = '//*[@id="ember386"]/div[1]/div/a') %>% html_attr('href')
【问题讨论】:
标签: r api web-scraping