Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试在 Google 缓存中进行搜索,因此我需要触发此查询:
http://webcache.googleusercontent.com/search?q=cache:news.ycombinator.com/news+hacker+news
并从页面中获取一些内容,例如时间戳。但是当我使用 curl (ruby) 执行此操作时,它给出了一个权限被拒绝错误,即抓取被阻止,这是意料之中的。
那么,有没有办法搜索谷歌缓存(API 或某种解决方法抓取)并提取一些信息,如时间戳?
我没有得到任何 API,但我可以在 rails 中使用hpricot或nokogiri来抓取它(Rails 中的 curl 给出权限被拒绝错误)。一旦我弄清楚如何使用这些 gem 从上述 URL 中提取时间戳,我将提供代码。
任何人有更好的解决方案?
这看起来可以做到:http ://code.google.com/apis/soapsearch/reference.html#1_2