Ruby-on-Rails nokogiri Local Scraping Question.

Asked 2 years ago, Updated 2 years ago, 139 views

#.rb
require 'open-uri'
require 'Nokogiri'
...
#@data_url = "http://localhost/"
#@data_url = "http://localhost:3000/"
@data_url = "http://127.0.0.1/"
  @page = Nokogiri::HTML((@data_url),nil,'euc-kr')
@send = @page.css("div.footer-info01").text

#.html.rb
<h1><%=@page%></h1>
<div><%=@send%></div>

Information about www.xxx.com other than localhost can be scraped When you run from the source above, an infinite wait appears.

Can't nokogiri read the localhost page? Is it because of the approach?

ruby ruby-on-rails nokogiri

2022-09-21 18:04

1 Answers

Local servers can, of course, be read. I think you should check first to see if the local server is properly bound to be accessible with 127.0.0.1 IP, and if the port is 80 ports.


2022-09-21 18:04

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.