Home>

I want to create a crawler.
As an exercise, I would like to acquire the tabelog shop information and save it individually in the DB.

Current code
require'nokogiri'
require'anemone'
require'open-uri'
# Target URL
url = "https://tabelog.com/"
html = open (url) .read
Carve with # Nokogiri
doc = Nokogiri :: HTML (html, url)
# Display the title of the office
puts "store name"
doc.css ('h1'). each do | link |
  puts link.content
  link = Shop.new
  link.name = link.content
  link.save
end

At this time,

Nationwide gourmet restaurant guide Tabelog

You can display it like this.

However, I would like to eat this and go around the tabelog site to get the name of the store.

If i am familiar with this, please let me know.

  • Answer # 1

    First of all, if you get the information by this method of the questioner and use the shop information on your own HP, you can use it without permission.

    Normally, when doing this kind of thing, a mechanism called Web API is used.
    (Google, youtube, etc. can also be used this way)
    This is provided by the service side. Other than using this, it is NG.

    It seems that tabelog was provided before
    It seems that he is not going now.
    Since the tabelog API has been discontinued, I searched for an alternative API (list)