我想从这个*页面中删除内容.我查找的所有内容都提供了解析CSS元素的解决方案; 但是,那个页面没有.
这是我发现的唯一代码应该有效的代码:
file = File.open('http://hiscore.runescape.com/index_lite.ws?player=zezima', "r")
contents = file.read
puts contents
Run Code Online (Sandbox Code Playgroud)
错误:
tracker.rb:1:in 'initialize': Invalid argument - http://hiscore.runescape.com/index_lite.ws?player=zezima (Errno::EINVAL)
from tracker.rb:1:in 'open'
from tracker.rb:1
Run Code Online (Sandbox Code Playgroud)
*http://hiscore.runescape.com/index_lite.ws?player=zezima
如果您尝试将其格式化为帖子中的链接,则由于某种原因它无法识别URL中的下划线(_).
我只是想从我的Rails控制器内部命中服务器,但不等待响应.这可能吗?(没有启动其他线程我出于性能原因无法做到这一点)