gpt4 book ai didi

ruby - 使用 Anemone 从网站获取网址列表时出错

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

代码:

require 'anemone'
Anemone.crawl("http://www.example.com/") do |anemone|
anemone.on_every_page do |page|
puts page.url
end
end

当我尝试这段代码时,我应该得到该网站上所有 url 的列表,但我得到的只是网站的名称。可能是什么错误以及如何获取所有网址的列表?

最佳答案

我猜 anemone 无法遵循重定向或类似的东西,因为“http://example.com”在其他站点上重定向了我。您是否尝试过抓取其他网站? http://stackoverflow.com ,例如。

关于ruby - 使用 Anemone 从网站获取网址列表时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12259906/

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