gpt4 book ai didi

ruby-on-rails - Anemone 擦洗一定的页面深度

转载 作者:数据小太阳 更新时间:2023-10-29 08:41:27 24 4
gpt4 key购买 nike

我不明白如何使用 Anemone 的触手部分。如果我对它的解释是正确的,我觉得我可以用它来从根目录中清除特定的页面深度。

  Anemone.crawl(start_url) do |anemone|
tentacle.new(i think but not working)
anemone.on_every_page do |page|
puts page.depth
puts page.url
end
end

我希望它到达距离根部 3 的深度。

这是 rdoc 所说的

http://anemone.rubyforge.org/doc/index.html

Public Class methods
new(link_queue, page_queue, opts = {})
Create a new Tentacle

Public Instance methods
run()
Gets links from @link_queue, and returns the fetched Page objects into @page_queue

谢谢

最佳答案

明白了:)

Anemone.crawl(domain, :depth_limit => 1) do | anemone |
anemone.storage = Anemone::Storage.MongoDB
anemone.on_every_page do |page|
puts page.url
puts page.depth

end
end

关于ruby-on-rails - Anemone 擦洗一定的页面深度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3843866/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com