|
|
|
@ -7,7 +7,7 @@ require "csv"
|
|
|
|
|
|
|
|
|
|
restaurants = []
|
|
|
|
|
|
|
|
|
|
csv = CSV.open("data/#{Date.today.to_s}-all.csv", 'w')
|
|
|
|
|
csv = CSV.open("data/#{Date.today.to_s}.csv", 'w')
|
|
|
|
|
|
|
|
|
|
first = true
|
|
|
|
|
Dir.glob('html/restaurants/*.html') do |file|
|
|
|
|
@ -59,9 +59,11 @@ Dir.glob('html/restaurants/*.html') do |file|
|
|
|
|
|
end
|
|
|
|
|
rest['status'] = r['sections']['SECTION_BASIC_INFO']['res_status_text']
|
|
|
|
|
if ratings and ratings.has_key? 'rating_streak'
|
|
|
|
|
rest['last_rating_timestamp'] = ratings['rating_streak'][-1]['timestamp']
|
|
|
|
|
rest['last_rating_timestamp'] = Time.at(ratings['rating_streak'][-1]['timestamp']).strftime('%Y-%m-%d')
|
|
|
|
|
rest['last_rating_month'] = Time.at(ratings['rating_streak'][-1]['timestamp']).strftime('%Y-%m')
|
|
|
|
|
else
|
|
|
|
|
rest['last_rating_timestamp'] = Date.new(2020, 01,01).strftime('%s')
|
|
|
|
|
rest['last_rating_timestamp'] = '1970-01-01'
|
|
|
|
|
rest['last_rating_month'] = '1970-01'
|
|
|
|
|
end
|
|
|
|
|
rest['id'] = data['pages']['current']['resId']
|
|
|
|
|
if first
|
|
|
|
|