Skip to content

Commit defb575

Browse files
committed
scrape # of career wins also
1 parent a57f2d1 commit defb575

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/bnet_scraper/starcraft2/profile_scraper.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ module Starcraft2
3030
class ProfileScraper < BaseScraper
3131
attr_reader :achievement_points, :career_games, :race, :leagues, :most_played,
3232
:games_this_season, :highest_solo_league, :current_solo_league, :highest_team_league,
33-
:current_team_league, :portrait
33+
:current_team_league, :portrait,
34+
:career_zerg_wins, :career_protoss_wins, :career_terran_wins
3435

3536
def initialize options = {}
3637
super
@@ -57,7 +58,7 @@ def get_profile_data
5758
portrait_map, portrait_size = portrait[0].scan(/(\d)\-(\d+)\.jpg/)[0]
5859
portrait_position = (((0-portrait[2].to_i) / portrait_size.to_i) * 6) + ((0-portrait[1].to_i) / portrait_size.to_i + 1)
5960
PORTRAITS[portrait_map.to_i][portrait_position-1]
60-
rescue
61+
rescue
6162
nil
6263
end
6364

@@ -66,6 +67,9 @@ def get_profile_data
6667
@career_games = html.css(".career-stat-block:nth-child(4) .stat-value").inner_html()
6768
@most_played = html.css(".stat-block:nth-child(2) h2").inner_html()
6869
@games_this_season = html.css(".career-stat-block:nth-child(5) .stat-value").inner_html()
70+
@career_terran_wins = html.css(".career-stat-block:nth-child(1) .stat-value").inner_html()
71+
@career_zerg_wins = html.css(".career-stat-block:nth-child(2) .stat-value").inner_html()
72+
@career_protoss_wins = html.css(".career-stat-block:nth-child(3) .stat-value").inner_html()
6973

7074
if html.css("#best-finish-SOLO div")[0]
7175
@highest_solo_league = html.css("#best-finish-SOLO div")[0].children[2].inner_text.strip

0 commit comments

Comments
 (0)