【发布时间】:2018-02-10 06:51:23
【问题描述】:
我正在尝试抓取 svg 地图上的所有链接。很抱歉,我无法发布链接,因为您需要登录,但 html 文件如下所示:
...
<div class = 'header'>
<div class = 'headermenu'>
## only other place where there exists <a href> tabs
<a href = 'link_is_here'>...</a>
## four more of them, separated with non-breaking spaces
</div>
</div>
<div class = 'main'></div>
<svg parameters_of_graphic>
## paths for images
<a href='link_is_here' parameters_of_link>
## path for above link
</a>
## paths for images
<a href='link_is_here' parameters_of_link>
<circle parameters_of_circle></circle>
</a>
## multiple circle links of same format
</svg>
...
但是,当我使用home_url %>% read_html() %>% html_nodes('a') 时,我只得到了头类下的五个节点。我尝试使用 rvest 寻找 svg 抓取,但在 svg 选项卡下找不到任何抓取节点的方法。有没有办法在 R 中做到这一点?
【问题讨论】:
标签: html r svg web-scraping rvest