about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-02-23 10:40:43 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-02-23 10:40:43 -0500
commitd1e935fe125e89ad30e534b9614abca256af3ee9 (patch)
tree3083fcb00aa8bdb6f4f1c2eb00ac5c66976382a2
parentfc52b357a1f865ea4facedad0012704be5dae71f (diff)
downloadlunatic-d1e935fe125e89ad30e534b9614abca256af3ee9.tar.gz
lunatic-d1e935fe125e89ad30e534b9614abca256af3ee9.tar.bz2
lunatic-d1e935fe125e89ad30e534b9614abca256af3ee9.zip
Scraper can scrape number-based user profiles
-rw-r--r--scrape.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/scrape.rb b/scrape.rb index c70fcff..92730a5 100644 --- a/scrape.rb +++ b/scrape.rb
@@ -7,13 +7,13 @@ config = YAML.load(open(ARGV[0]))
7usernames = config["usernames"] 7usernames = config["usernames"]
8 8
9achieves = usernames.map do |username| 9achieves = usernames.map do |username|
10 page = Nokogiri::HTML(open("https://steamcommunity.com/id/#{username}/games/?tab=all")) 10 page = Nokogiri::HTML(open("https://steamcommunity.com/#{username}/games/?tab=all"))
11 script = page.css(".responsive_page_template_content script").text[18..-1] 11 script = page.css(".responsive_page_template_content script").text[18..-1]
12 data = JSON.parse(script[0..script.index(";\r\n\t\t")-1]) 12 data = JSON.parse(script[0..script.index(";\r\n\t\t")-1])
13 ids = data.map { |d| d["appid"] } 13 ids = data.map { |d| d["appid"] }
14 14
15 ids.map do |id| 15 ids.map do |id|
16 achsp = Nokogiri::HTML(open("https://steamcommunity.com/id/#{username}/stats/#{id}/")) 16 achsp = Nokogiri::HTML(open("https://steamcommunity.com/#{username}/stats/#{id}/"))
17 achsp.css(".achieveTxt .achieveUnlockTime + h3").map { |d| d.text } 17 achsp.css(".achieveTxt .achieveUnlockTime + h3").map { |d| d.text }
18 end 18 end
19end.flatten 19end.flatten