Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
fix: unified camel case for review
Browse files Browse the repository at this point in the history
  • Loading branch information
korosuke613 committed Aug 2, 2020
1 parent b611a98 commit 822a8e1
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions scrapingSource/scraping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
puts "no info_list"
exit
end
info_list = driver.find_element(:class => "info_list")
scrapedNews = info_list.find_elements(:tag_name => "a")
infoList = driver.find_element(:class => "info_list")
scrapedNews = infoList.find_elements(:tag_name => "a")
count = scrapedNews.length - 1
newsItems = []
for i in 0..count do
Expand All @@ -20,25 +20,25 @@
puts news

# JSON出力
news_json = JSON.pretty_generate(news, {:indent => " "})
newsJson = JSON.pretty_generate(news, {:indent => " "})
File.open("data/news.json", mode = "w") { |f|
f.write(news_json)
f.write(newsJson)
}

pcr_table = driver.find_elements(:class => "datatable").last
rows = pcr_table.find_elements(:tag_name => "tr").last
pcrTable = driver.find_elements(:class => "datatable").last
rows = pcrTable.find_elements(:tag_name => "tr").last
total = rows.find_element(:tag_name => "td").find_element(:tag_name => "p")

data_hash = {}
dataHash = {}
File.open("data/data.json") do |file|
data_hash = JSON.load(file)
dataHash = JSON.load(file)
end

data_hash["main_summary"]["value"] = total.text.delete(",").to_i
dataHash["main_summary"]["value"] = total.text.delete(",").to_i

data_json = JSON.pretty_generate(data_hash, {:indent => " "})
dataJson = JSON.pretty_generate(dataHash, {:indent => " "})
File.open("data/data.json", mode = "w") { |f|
f.write(data_json)
f.write(dataJson)
}

exit
Expand Down

0 comments on commit 822a8e1

Please sign in to comment.