現在VPSサーバ上にjenkinsを置いてrubyプログラムを動かしているのですがその際にタイトルのエラーがおきまして質問させていただきます
詳細はこちら
/var/lib/jenkins/.rbenv/versions/2.5.1/lib/ruby/2.5.0/open-uri.rb:377:in `open_http': 400 Bad Request (OpenURI::HTTPError) from /var/lib/jenkins/.rbenv/versions/2.5.1/lib/ruby/2.5.0/open-uri.rb:755:in `buffer_open' from /var/lib/jenkins/.rbenv/versions/2.5.1/lib/ruby/2.5.0/open-uri.rb:226:in `block in open_loop' from /var/lib/jenkins/.rbenv/versions/2.5.1/lib/ruby/2.5.0/open-uri.rb:224:in `catch' from /var/lib/jenkins/.rbenv/versions/2.5.1/lib/ruby/2.5.0/open-uri.rb:224:in `open_loop' from /var/lib/jenkins/.rbenv/versions/2.5.1/lib/ruby/2.5.0/open-uri.rb:165:in `open_uri' from /var/lib/jenkins/.rbenv/versions/2.5.1/lib/ruby/2.5.0/open-uri.rb:735:in `open' from /var/lib/jenkins/.rbenv/versions/2.5.1/lib/ruby/2.5.0/open-uri.rb:35:in `open' from .rb:17:in `block (2 levels) in <main>' from .rb:13:in `each' from .rb:13:in `block in <main>' from .rb:12:in `open' from .rb:12:in `<main>' Build step 'Execute shell' marked build as failure Archiving artifacts Finished: FAILURE
該当のコードはこちらになります
def scraping(keyword) submit_keyword(keyword) @agent.page.search('div.g').map do |node| title = node.search('a') next if title.empty? query = URI.decode_www_form(URI(title.attr("href")).query) url = query[0][1] snipped = node.search('div.s > span.st') next if snipped.empty? || snipped.children.empty? { url: url, title: expect_tag(title.children.to_html), } end.reject do |list| list.nil? end end query = URI.decode_www_form(URI(title.attr("href")).query) def submit_keyword(keyword) @agent = Mechanize.new @agent.user_agent_alias = USER_AGENT @agent.get('https://www.google.co.jp/') @agent.page.form_with(name: 'f') do |form| form.q = keyword end.submit end def expect_tag(string) string.gsub(/(<b>|</b>|<br>|</br>|\R)/, '') end
Googleにアクセスしてキーワードを抽出するプログラムなのですがローカルでは動いておりましてvps上では動いていないので何かjenkinsや他に同様のエラーで知見のある方がいらっしゃいましたらご教授いただけますと幸いです
よろしくお願い致します
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/08/13 23:47
2019/08/14 00:22
退会済みユーザー
2019/08/14 00:34
2019/08/14 00:40
退会済みユーザー
2019/08/14 00:56
2019/08/14 04:29
2019/08/14 04:41