diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-02-23 10:40:43 -0500 | 
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-02-23 10:40:43 -0500 | 
| commit | d1e935fe125e89ad30e534b9614abca256af3ee9 (patch) | |
| tree | 3083fcb00aa8bdb6f4f1c2eb00ac5c66976382a2 | |
| parent | fc52b357a1f865ea4facedad0012704be5dae71f (diff) | |
| download | lunatic-d1e935fe125e89ad30e534b9614abca256af3ee9.tar.gz lunatic-d1e935fe125e89ad30e534b9614abca256af3ee9.tar.bz2 lunatic-d1e935fe125e89ad30e534b9614abca256af3ee9.zip | |
Scraper can scrape number-based user profiles
| -rw-r--r-- | scrape.rb | 4 | 
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])) | |||
| 7 | usernames = config["usernames"] | 7 | usernames = config["usernames"] | 
| 8 | 8 | ||
| 9 | achieves = usernames.map do |username| | 9 | achieves = 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 | 
| 19 | end.flatten | 19 | end.flatten | 
