bnet_scraper 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -0
- data/README.md +17 -1
- data/bnet_scraper.gemspec +1 -1
- data/lib/bnet_scraper/starcraft2.rb +6 -5
- data/lib/bnet_scraper/starcraft2/achievement_scraper.rb +34 -0
- data/lib/bnet_scraper/starcraft2/base_scraper.rb +17 -1
- data/lib/bnet_scraper/starcraft2/league_scraper.rb +15 -8
- data/lib/bnet_scraper/starcraft2/match_history_scraper.rb +2 -2
- data/lib/bnet_scraper/starcraft2/profile_scraper.rb +21 -18
- data/lib/bnet_scraper/starcraft2/status_scraper.rb +39 -0
- data/spec/starcraft2/status_scraper_spec.rb +16 -0
- data/spec/support/load_fakeweb.rb +17 -15
- data/spec/support/shared/sc2_scraper.rb +1 -1
- data/spec/support/status.html +1 -0
- metadata +17 -12
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# BnetScraper
|
1
|
+
# BnetScraper [![Build Status](https://secure.travis-ci.org/agoragames/bnet_scraper.png)](http://travis-ci.org/agoragames/bnet_scraper)
|
2
2
|
|
3
3
|
BnetScraper is a Nokogiri-based scraper of Battle.net profile information. Currently this only includes Starcraft2.
|
4
4
|
|
@@ -125,6 +125,22 @@ scraper.scrape
|
|
125
125
|
}
|
126
126
|
```
|
127
127
|
|
128
|
+
## BnetScraper::Starcraft2::Status
|
129
|
+
|
130
|
+
Scraping is only possible if the site is up. Use this if you want to verify the failed scrape is because the site is down:
|
131
|
+
|
132
|
+
``` ruby
|
133
|
+
BnetScraper::Starcraft2::Status.na # => 'Online'
|
134
|
+
BnetScraper::Starcraft2::Status.fea # => 'Offline'
|
135
|
+
BnetScraper::Starcraft2::Status.cn # => nil (China is unsupported)
|
136
|
+
BnetScraper::Starcraft2::Status.fetch # => [
|
137
|
+
{:region=>"North America", :status=>"Online"},
|
138
|
+
{:region=>"Europe", :status=>"Online"},
|
139
|
+
{:region=>"Korea", :status=>"Online"},
|
140
|
+
{:region=>"South-East Asia", :status=>"Online"}
|
141
|
+
]
|
142
|
+
```
|
143
|
+
|
128
144
|
# Contribute!
|
129
145
|
|
130
146
|
I would love to see contributions! Please send a pull request with a feature branch containing specs
|
data/bnet_scraper.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "bnet_scraper"
|
6
|
-
s.version = "0.0.
|
6
|
+
s.version = "0.0.2"
|
7
7
|
s.authors = ["Andrew Nordman"]
|
8
8
|
s.email = ["anordman@majorleaguegaming.com"]
|
9
9
|
s.homepage = "https://github.com/agoragames/bnet_scraper/"
|
@@ -3,6 +3,7 @@ require 'bnet_scraper/starcraft2/profile_scraper'
|
|
3
3
|
require 'bnet_scraper/starcraft2/league_scraper'
|
4
4
|
require 'bnet_scraper/starcraft2/achievement_scraper'
|
5
5
|
require 'bnet_scraper/starcraft2/match_history_scraper'
|
6
|
+
require 'bnet_scraper/starcraft2/status_scraper'
|
6
7
|
|
7
8
|
module BnetScraper
|
8
9
|
# This module contains everything about scraping Starcraft 2 Battle.net accounts.
|
@@ -10,11 +11,11 @@ module BnetScraper
|
|
10
11
|
# for more details
|
11
12
|
module Starcraft2
|
12
13
|
REGIONS = {
|
13
|
-
'na' => { domain: 'us.battle.net', dir: 'en' },
|
14
|
-
'eu' => { domain: 'eu.battle.net', dir: 'eu' },
|
15
|
-
'cn' => { domain: 'www.battlenet.com.cn', dir: 'zh' },
|
16
|
-
'sea' => { domain: 'sea.battle.net', dir: 'en' },
|
17
|
-
'fea' => { domain: 'tw.battle.net', dir: 'zh' }
|
14
|
+
'na' => { domain: 'us.battle.net', dir: 'en', label: 'North America' },
|
15
|
+
'eu' => { domain: 'eu.battle.net', dir: 'eu', label: 'Europe' },
|
16
|
+
'cn' => { domain: 'www.battlenet.com.cn', dir: 'zh', label: 'China' },
|
17
|
+
'sea' => { domain: 'sea.battle.net', dir: 'en', label: 'South-East Asia' },
|
18
|
+
'fea' => { domain: 'tw.battle.net', dir: 'zh', label: 'Korea' }
|
18
19
|
}
|
19
20
|
|
20
21
|
# This is a convenience method that chains calls to ProfileScraper,
|
@@ -1,5 +1,35 @@
|
|
1
1
|
module BnetScraper
|
2
2
|
module Starcraft2
|
3
|
+
# This pulls achievement information for an account. Note that currently only returns the overall achievements,
|
4
|
+
# not the in-depth, by-category achievement information.
|
5
|
+
#
|
6
|
+
# scraper = BnetScraper::Starcraft2::AchievementScraper.new(url: 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/')
|
7
|
+
# scraper.scrape
|
8
|
+
# # => {
|
9
|
+
# recent: [
|
10
|
+
# { title: 'Blink of an Eye', description: 'Complete round 24 in "Starcraft Master" without losing any stalkers', earned: '3/5/2012' },
|
11
|
+
# { title: 'Whack-a-Roach', description: 'Complete round 9 in "Starcraft Master" in under 45 seconds', earned: '3/5/2012' },
|
12
|
+
# { title: 'Safe Zone', description: 'Complete round 8 in "Starcraft Master" without losing any stalkers', earned: '3/5/2012' },
|
13
|
+
# { title: 'Starcraft Master', description: 'Complete all 30 rounds in "Starcraft Master"', earned: '3/5/2012' },
|
14
|
+
# { title: 'Starcraft Expert', description: 'Complete any 25 rounds in "Starcraft Master"', earned: '3/5/2012' },
|
15
|
+
# { title: 'Starcraft Apprentice', description: 'Complete any 20 rounds in "Starcraft Master"', earned: '3/5/2012' }
|
16
|
+
# ],
|
17
|
+
# showcase: [
|
18
|
+
# { title: 'Hot Shot', description: 'Finish a Qualification Round with an undefeated record.' },
|
19
|
+
# { title: 'Starcraft Master', description: 'Complete all rounds in "Starcraft Master"' },
|
20
|
+
# { title: 'Team Protoss 500', description: 'Win 500 team league matches as Protoss' },
|
21
|
+
# { title: 'Night of the Living III', description: 'Survive 15 Infested Horde Attacks in the "Night 2 Die" mode of the "Left 2 Die" scenario.' },
|
22
|
+
# { title: 'Team Top 100 Diamond', description: 'Finish a Season in Team Diamond Division' }
|
23
|
+
#
|
24
|
+
# ],
|
25
|
+
# progress: {
|
26
|
+
# liberty_campaign: '1580',
|
27
|
+
# exploration: '480',
|
28
|
+
# custom_game: '330',
|
29
|
+
# cooperative: '660',
|
30
|
+
# quick_match: '170'
|
31
|
+
# }
|
32
|
+
# }
|
3
33
|
class AchievementScraper < BaseScraper
|
4
34
|
attr_reader :recent, :progress, :showcase, :response
|
5
35
|
|
@@ -11,10 +41,12 @@ module BnetScraper
|
|
11
41
|
output
|
12
42
|
end
|
13
43
|
|
44
|
+
# retrieves the account's achievements overview page HTML for scraping
|
14
45
|
def get_response
|
15
46
|
@response = Nokogiri::HTML(open(profile_url+"achievements/"))
|
16
47
|
end
|
17
48
|
|
49
|
+
# scrapes the recent achievements from the account's achievements overview page
|
18
50
|
def scrape_recent
|
19
51
|
@recent = []
|
20
52
|
6.times do |num|
|
@@ -31,6 +63,7 @@ module BnetScraper
|
|
31
63
|
@recent
|
32
64
|
end
|
33
65
|
|
66
|
+
# scrapes the progress of each achievement category from the account's achievements overview page
|
34
67
|
def scrape_progress
|
35
68
|
progress_ach = response.css("#progress-module .achievements-progress:nth(2) span")
|
36
69
|
@progress = {
|
@@ -42,6 +75,7 @@ module BnetScraper
|
|
42
75
|
}
|
43
76
|
end
|
44
77
|
|
78
|
+
# scrapes the showcase achievements from the account's achievements overview page
|
45
79
|
def scrape_showcase
|
46
80
|
@showcase = response.css("#showcase-module .progress-tile").map do |achievement|
|
47
81
|
hsh = { title: achievement.css('.tooltip-title').inner_text.strip }
|
@@ -1,12 +1,26 @@
|
|
1
1
|
module BnetScraper
|
2
2
|
module Starcraft2
|
3
|
+
# BaseScraper handles the account information extraction. Each scraper can either be passed a profile URL or
|
4
|
+
# the minimum information needed to access an account. This means passing in account and bnet_id at minimum.
|
5
|
+
# Both of the following are valid ways to instantiate a scraper for the same account:
|
6
|
+
#
|
7
|
+
# BnetScraper::Starcraft2::BaseScraper.new(url: 'http://us.battle.net/sc2/en/profile/12345/1/TestAccount/')
|
8
|
+
# BnetScraper::Starcraft2::BaseScraper.new(bnet_id: '12345', account: 'TestAccount')
|
9
|
+
#
|
10
|
+
# The URL scheme is the following:
|
11
|
+
#
|
12
|
+
# http://<REGION_DOMAIN>/sc2/<REGION_LANG>/profile/<BNET_ID>/<BNET_INDEX>/<ACCOUNT>/
|
13
|
+
#
|
14
|
+
# Note that by default, the region will be set to 'na' if you opt not to specify the URL or region. The
|
15
|
+
# scraper uses the short-codes for regions. See `BnetScraper::Starcraft2::REGIONS` for the address
|
16
|
+
# translations.
|
3
17
|
class BaseScraper
|
4
18
|
attr_reader :bnet_id, :account, :region, :bnet_index, :url
|
5
19
|
|
6
20
|
def initialize options = {}
|
7
21
|
if options[:url]
|
8
22
|
extracted_data = options[:url].match(/http:\/\/(.+)\/sc2\/(.+)\/profile\/(.+)\/(\d{1})\/(.[^\/]+)\//)
|
9
|
-
@region
|
23
|
+
@region = REGIONS.select { |k,v| v[:domain] == extracted_data[1] && v[:dir] == extracted_data[2] }.first.first
|
10
24
|
@bnet_id = extracted_data[3]
|
11
25
|
@bnet_index = extracted_data[4]
|
12
26
|
@account = extracted_data[5]
|
@@ -41,6 +55,8 @@ module BnetScraper
|
|
41
55
|
"http://#{region_info[:domain]}/sc2/#{region_info[:dir]}/profile/#{bnet_id}/#{bnet_index}/#{account}/"
|
42
56
|
end
|
43
57
|
|
58
|
+
# converts region short-code to region-based URL information
|
59
|
+
# 'na' => { domain: 'us.battle.net', :dir: 'en' }
|
44
60
|
def region_info
|
45
61
|
REGIONS[region]
|
46
62
|
end
|
@@ -1,17 +1,24 @@
|
|
1
1
|
module BnetScraper
|
2
2
|
module Starcraft2
|
3
|
-
#
|
3
|
+
# This pulls information on a specific league for a specific account. It is best used either in conjunction with a
|
4
|
+
# profile scrape that profiles a URL, or if you happen to know the specific league\_id and can pass it as an option.
|
4
5
|
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
6
|
+
# scraper = BnetScraper::Starcraft2::LeagueScraper.new(league_id: '12345', account: 'Demon', bnet_id: '2377239')
|
7
|
+
# scraper.scrape
|
8
|
+
# # => {
|
9
|
+
# season: '6',
|
10
|
+
# name: 'Aleksander Pepper',
|
11
|
+
# division: 'Diamond',
|
12
|
+
# size: '4v4',
|
13
|
+
# random: false,
|
14
|
+
# bnet_id: '2377239',
|
15
|
+
# account: 'Demon'
|
16
|
+
# }
|
12
17
|
class LeagueScraper < BaseScraper
|
13
18
|
attr_reader :league_id, :season, :size, :random, :name, :division
|
14
19
|
|
20
|
+
# @param [String] url - The league URL on battle.net
|
21
|
+
# @return [Hash] league_data - Hash of data extracted
|
15
22
|
def initialize options = {}
|
16
23
|
super(options)
|
17
24
|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module BnetScraper
|
2
2
|
module Starcraft2
|
3
|
-
## BnetScraper::Starcraft2::MatchHistoryScraper
|
4
|
-
#
|
5
3
|
# This pulls the 25 most recent matches played for an account. Note that this is only as up-to-date as battle.net is, and
|
6
4
|
# will likely not be as fast as in-game.
|
7
5
|
#
|
@@ -20,10 +18,12 @@ module BnetScraper
|
|
20
18
|
class MatchHistoryScraper < BaseScraper
|
21
19
|
attr_reader :matches, :wins, :losses, :response
|
22
20
|
|
21
|
+
# account's match history URL
|
23
22
|
def match_url
|
24
23
|
profile_url + "matches"
|
25
24
|
end
|
26
25
|
|
26
|
+
# retrieves the match history HTML for scraping
|
27
27
|
def get_response
|
28
28
|
@response = Nokogiri::HTML(open(match_url))
|
29
29
|
end
|
@@ -1,24 +1,25 @@
|
|
1
1
|
module BnetScraper
|
2
2
|
module Starcraft2
|
3
|
-
#
|
3
|
+
# This pulls basic profile information for an account, as well as an array of league URLs. This is a good starting
|
4
|
+
# point for league scraping as it provides the league URLs necessary to do supplemental scraping.
|
4
5
|
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
6
|
+
# scraper = BnetScraper::Starcraft2::ProfileScraper.new(url: 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/')
|
7
|
+
# scraper.scrape
|
8
|
+
# # => {
|
9
|
+
# bnet_id: '2377239',
|
10
|
+
# account: 'Demon',
|
11
|
+
# bnet_index: 1,
|
12
|
+
# race: 'Protoss',
|
13
|
+
# wins: '684',
|
14
|
+
# achievement_points: '3630',
|
15
|
+
# leagues: [
|
16
|
+
# {
|
17
|
+
# name: "1v1 Platinum Rank 95",
|
18
|
+
# id: "96905",
|
19
|
+
# href: "http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/96905#current-rank"
|
20
|
+
# }
|
21
|
+
# ]
|
22
|
+
# }
|
22
23
|
class ProfileScraper < BaseScraper
|
23
24
|
attr_reader :achievement_points, :wins, :race, :leagues
|
24
25
|
def scrape
|
@@ -27,6 +28,7 @@ module BnetScraper
|
|
27
28
|
output
|
28
29
|
end
|
29
30
|
|
31
|
+
# scrapes the profile page for basic account information
|
30
32
|
def get_profile_data
|
31
33
|
response = Nokogiri::HTML(open(profile_url))
|
32
34
|
|
@@ -35,6 +37,7 @@ module BnetScraper
|
|
35
37
|
@achievement_points = response.css("#profile-header h3").inner_html()
|
36
38
|
end
|
37
39
|
|
40
|
+
# scrapes the league list from account's league page and sets an array of URLs
|
38
41
|
def get_league_list
|
39
42
|
response = Nokogiri::HTML(open(profile_url + "ladder/leagues"))
|
40
43
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module BnetScraper
|
2
|
+
module Starcraft2
|
3
|
+
# Ask the TL.net bot if Battle.Net is currently online for a given region.
|
4
|
+
# This page is updated every 5 minutes. Call #fetch to refresh.
|
5
|
+
#
|
6
|
+
# Examples:
|
7
|
+
# BnetScraper::Starcraft2::Status.na => 'Online'
|
8
|
+
# BnetScraper::Starcraft2::Status.fea => 'Offline'
|
9
|
+
# BnetScraper::Starcraft2::Status.cn => nil (China is unsupported)
|
10
|
+
# BnetScraper::Starcraft2::Status.fetch => [
|
11
|
+
# {:region=>"North America", :status=>"Online"},{:region=>"Europe", :status=>"Online"},
|
12
|
+
# {:region=>"Korea", :status=>"Online"}, {:region=>"South-East Asia", :status=>"Online"}
|
13
|
+
# ]
|
14
|
+
class Status
|
15
|
+
SOURCE = 'http://www.teamliquid.net/forum/viewmessage.php?topic_id=138846'
|
16
|
+
|
17
|
+
class << self
|
18
|
+
|
19
|
+
def fetch
|
20
|
+
Nokogiri::HTML(open(SOURCE))
|
21
|
+
.css('.forumPost').first.css('span').to_a
|
22
|
+
.each_slice(2).map { |i| { :region => i.first.text, :status => i.last.text } }
|
23
|
+
end
|
24
|
+
|
25
|
+
def method_missing sym
|
26
|
+
status? sym if REGIONS.reject { |r| r == 'cn' }.include?(sym.to_s)
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
def status? region
|
31
|
+
@status ||= fetch
|
32
|
+
@status.select do |r|
|
33
|
+
r[:region] == REGIONS.select { |k,v| k == region.to_s }.first.last[:label]
|
34
|
+
end.first[:status]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BnetScraper::Starcraft2::Status do
|
4
|
+
describe 'Each supported region' do
|
5
|
+
it 'should be online' do
|
6
|
+
BnetScraper::Starcraft2::Status.na.should == 'Online'
|
7
|
+
BnetScraper::Starcraft2::Status.eu.should == 'Online'
|
8
|
+
BnetScraper::Starcraft2::Status.sea.should == 'Online'
|
9
|
+
BnetScraper::Starcraft2::Status.fea.should == 'Online'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'China' do
|
14
|
+
BnetScraper::Starcraft2::Status.cn.should == nil
|
15
|
+
end
|
16
|
+
end
|
@@ -5,22 +5,24 @@ leagues_html = File.read File.dirname(__FILE__) + '/leagues.html'
|
|
5
5
|
league_html = File.read File.dirname(__FILE__) + '/league.html'
|
6
6
|
achievements_html = File.read File.dirname(__FILE__) + '/achievements.html'
|
7
7
|
matches_html = File.read File.dirname(__FILE__) + '/matches.html'
|
8
|
+
status_html = File.read File.dirname(__FILE__) + '/status.html'
|
8
9
|
|
9
10
|
FakeWeb.allow_net_connect = false
|
10
11
|
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/', body: profile_html, status: 200, content_type: 'text/html'
|
11
12
|
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/leagues', body: leagues_html, status: 200, content_type: 'text/html'
|
12
|
-
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/12345',
|
13
|
-
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/96905',
|
14
|
-
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/96716',
|
15
|
-
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/98162',
|
16
|
-
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/97369',
|
17
|
-
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/96828',
|
18
|
-
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/97985',
|
19
|
-
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/98523',
|
20
|
-
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/96863',
|
21
|
-
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/97250',
|
22
|
-
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/96830',
|
23
|
-
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/98336',
|
24
|
-
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/98936',
|
25
|
-
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/achievements/',
|
26
|
-
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/matches',
|
13
|
+
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/12345', body: league_html, status: 200, content_type: 'text/html'
|
14
|
+
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/96905', body: league_html, status: 200, content_type: 'text/html'
|
15
|
+
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/96716', body: league_html, status: 200, content_type: 'text/html'
|
16
|
+
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/98162', body: league_html, status: 200, content_type: 'text/html'
|
17
|
+
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/97369', body: league_html, status: 200, content_type: 'text/html'
|
18
|
+
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/96828', body: league_html, status: 200, content_type: 'text/html'
|
19
|
+
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/97985', body: league_html, status: 200, content_type: 'text/html'
|
20
|
+
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/98523', body: league_html, status: 200, content_type: 'text/html'
|
21
|
+
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/96863', body: league_html, status: 200, content_type: 'text/html'
|
22
|
+
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/97250', body: league_html, status: 200, content_type: 'text/html'
|
23
|
+
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/96830', body: league_html, status: 200, content_type: 'text/html'
|
24
|
+
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/98336', body: league_html, status: 200, content_type: 'text/html'
|
25
|
+
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/98936', body: league_html, status: 200, content_type: 'text/html'
|
26
|
+
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/achievements/', body: achievements_html, status: 200, content_type: 'text/html'
|
27
|
+
FakeWeb.register_uri :get, 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/matches', body: matches_html, status: 200, content_type: 'text/html'
|
28
|
+
FakeWeb.register_uri :get, 'http://www.teamliquid.net/forum/viewmessage.php?topic_id=138846', body: status_html, status: 200, content_type: 'text/html'
|
@@ -49,7 +49,7 @@ shared_examples 'an SC2 Scraper' do
|
|
49
49
|
|
50
50
|
describe '#region_info' do
|
51
51
|
it 'should return information based on the set region' do
|
52
|
-
subject.region_info.should == { domain: 'us.battle.net', dir: 'en' }
|
52
|
+
subject.region_info.should == { domain: 'us.battle.net', dir: 'en', label: 'North America' }
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -0,0 +1 @@
|
|
1
|
+
<td class="forumPost" width="100%">Current StarCraft II Battle.Net status (auto-updated every five minutes):<br><br><span style="font-size: large">North America</span><br><span style="color: green">Online</span> (build 21028 - Patch 1.4.3)<br><br><span style="font-size: large">Europe</span><br><span style="color: green">Online</span> (build 21028 - Patch 1.4.3)<br><br><span style="font-size: large">Korea</span><br><span style="color: green">Online</span> (build 21028 - Patch 1.4.3)<br><br><span style="font-size: large">South-East Asia</span><br><span style="color: green">Online</span> (build 21028 - Patch 1.4.3)</td>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bnet_scraper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-04-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
16
|
-
requirement: &
|
16
|
+
requirement: &70132164572300 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70132164572300
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70132164571740 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70132164571740
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70132164571280 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70132164571280
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: fakeweb
|
49
|
-
requirement: &
|
49
|
+
requirement: &70132164570820 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70132164570820
|
58
58
|
description: BnetScraper is a Nokogiri-based scraper of Battle.net profile information.
|
59
59
|
Currently this only includes Starcraft2.
|
60
60
|
email:
|
@@ -79,12 +79,14 @@ files:
|
|
79
79
|
- lib/bnet_scraper/starcraft2/league_scraper.rb
|
80
80
|
- lib/bnet_scraper/starcraft2/match_history_scraper.rb
|
81
81
|
- lib/bnet_scraper/starcraft2/profile_scraper.rb
|
82
|
+
- lib/bnet_scraper/starcraft2/status_scraper.rb
|
82
83
|
- spec/spec_helper.rb
|
83
84
|
- spec/starcraft2/achievement_scraper_spec.rb
|
84
85
|
- spec/starcraft2/base_scraper_spec.rb
|
85
86
|
- spec/starcraft2/league_scraper_spec.rb
|
86
87
|
- spec/starcraft2/match_history_scraper_spec.rb
|
87
88
|
- spec/starcraft2/profile_scraper_spec.rb
|
89
|
+
- spec/starcraft2/status_scraper_spec.rb
|
88
90
|
- spec/starcraft2_spec.rb
|
89
91
|
- spec/support/achievements.html
|
90
92
|
- spec/support/league.html
|
@@ -93,6 +95,7 @@ files:
|
|
93
95
|
- spec/support/matches.html
|
94
96
|
- spec/support/profile.html
|
95
97
|
- spec/support/shared/sc2_scraper.rb
|
98
|
+
- spec/support/status.html
|
96
99
|
homepage: https://github.com/agoragames/bnet_scraper/
|
97
100
|
licenses: []
|
98
101
|
post_install_message:
|
@@ -107,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
110
|
version: '0'
|
108
111
|
segments:
|
109
112
|
- 0
|
110
|
-
hash: -
|
113
|
+
hash: -2131617336908961246
|
111
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
115
|
none: false
|
113
116
|
requirements:
|
@@ -116,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
119
|
version: '0'
|
117
120
|
segments:
|
118
121
|
- 0
|
119
|
-
hash: -
|
122
|
+
hash: -2131617336908961246
|
120
123
|
requirements: []
|
121
124
|
rubyforge_project:
|
122
125
|
rubygems_version: 1.8.17
|
@@ -130,6 +133,7 @@ test_files:
|
|
130
133
|
- spec/starcraft2/league_scraper_spec.rb
|
131
134
|
- spec/starcraft2/match_history_scraper_spec.rb
|
132
135
|
- spec/starcraft2/profile_scraper_spec.rb
|
136
|
+
- spec/starcraft2/status_scraper_spec.rb
|
133
137
|
- spec/starcraft2_spec.rb
|
134
138
|
- spec/support/achievements.html
|
135
139
|
- spec/support/league.html
|
@@ -138,3 +142,4 @@ test_files:
|
|
138
142
|
- spec/support/matches.html
|
139
143
|
- spec/support/profile.html
|
140
144
|
- spec/support/shared/sc2_scraper.rb
|
145
|
+
- spec/support/status.html
|