按照使用 Nokogiri 进行抓取的链接 [英] Following a link using Nokogiri for scraping

查看:34
本文介绍了按照使用 Nokogiri 进行抓取的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有使用 Nokogiri 进行抓取的链接的方法?我知道我可以提取 href 并打开它,但我想我看到了一种使用 hpricot 执行此操作的方法,并且想知道 Nokogiri 中是否有类似的东西.

Is there a method to follow a link using Nokogiri for scraping? I know I can extract the href and open it, but I thought I saw a method to do this using hpricot and was wondering if there was something like that in Nokogiri.

推荐答案

这里有一个很好的 屏幕抓取指南,用于使用 Ruby、Nokigiri、Hpricot 和 Firebug.

Here is an excellent screen scraping guide for using Ruby, Nokigiri, Hpricot, and Firebug.

就个人而言,我非常喜欢使用 Mechanize,这是一个无头浏览器,用于屏幕抓取.您可以使用机械化来导航链接和填写表单,它会处理所有棘手的事情,例如 cookie.

Personally I am a big fan of using Mechanize, which is a headless browser, for screen scraping. You can use mechanize to navigate links and fill out forms and it will handle all the tricky stuff like cookies.

这篇关于按照使用 Nokogiri 进行抓取的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆