From d1e935fe125e89ad30e534b9614abca256af3ee9 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 23 Feb 2018 10:40:43 -0500 Subject: Scraper can scrape number-based user profiles --- scrape.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scrape.rb') 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])) usernames = config["usernames"] achieves = usernames.map do |username| - page = Nokogiri::HTML(open("https://steamcommunity.com/id/#{username}/games/?tab=all")) + page = Nokogiri::HTML(open("https://steamcommunity.com/#{username}/games/?tab=all")) script = page.css(".responsive_page_template_content script").text[18..-1] data = JSON.parse(script[0..script.index(";\r\n\t\t")-1]) ids = data.map { |d| d["appid"] } ids.map do |id| - achsp = Nokogiri::HTML(open("https://steamcommunity.com/id/#{username}/stats/#{id}/")) + achsp = Nokogiri::HTML(open("https://steamcommunity.com/#{username}/stats/#{id}/")) achsp.css(".achieveTxt .achieveUnlockTime + h3").map { |d| d.text } end end.flatten -- cgit 1.4.1