ruby をインストールしましたが、うまく作動されてなくて、なぜなのか、教えていただきたいです。
ソース:
-- coding: utf-8 --
require 'rubygems'
require 'mechanize'
require 'kconv'
Setting
url = 'https://suumo.jp/chintai/hyogo/sc_kobeshinada/nj_204/'
#'https://suumo.jp/chintai/hyogo/sc_kobeshinada/'
#'http://suumo.jp/chintai/hyogo/sc_kobeshisuma/'
#'https://suumo.jp/chintai/hyogo/sc_kobeshinada/'
#'https://suumo.jp/chintai/hyogo/sc_kobeshinada/nj_204/'
open('1.html', 'w'){|io| io.write(url.body) }
#############################
AGENT_ALIASES = [
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36'
]
agent = Mechanize.new
agent.verify_mode = OpenSSL::SSL::VERIFY_NONE
agent.cookie_jar.clear!
agent.follow_meta_refresh = true
agent.user_agent = AGENT_ALIASES[0]
agent.max_history = 2
エラー:
C:\Users\NEC04\Desktop\suumo>ruby suumo.rb
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/net-http-persistent-3.0.0/lib/net/http/persistent.rb:205:in <class:Persistent>': uninitialized constant Process::RLIMIT_NOFILE (NameError) from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/net-http-persistent-3.0.0/lib/net/http/persistent.rb:190:in
<top (required)>'
from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in
require'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/mechanize-2.7.6/lib/mechanize.rb:6:in <top (required)>' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in
require'
from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in rescue in require' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:39:in
require'
from suumo.rb:3:in `<main>'
回答2件
あなたの回答
tips
プレビュー