Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions sc2reader/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ def __getstate__(self):


class Map(Resource):
url_template = "http://{0}.depot.battle.net:1119/{1}.s2ma"
url_template = "https://{}-s2-depot.classic.blizzard.com/{}.s2ma"

def __init__(self, map_file, filename=None, region=None, map_hash=None, **options):
super(Map, self).__init__(map_file, filename, **options)
Expand Down Expand Up @@ -1021,7 +1021,7 @@ class GameSummary(Resource):
that the data is not necessarily in the places we expect.
"""

url_template = "http://{0}.depot.battle.net:1119/{1}.s2gs"
url_template = "https://{}-s2-depot.classic.blizzard.com/{}.s2gs"

#: Game speed
game_speed = str()
Expand Down Expand Up @@ -1450,9 +1450,9 @@ def __str__(self):
class MapHeader(Resource):
"""**Experimental**"""

base_url_template = "http://{0}.depot.battle.net:1119/{1}.{2}"
url_template = "http://{0}.depot.battle.net:1119/{1}.s2mh"
image_url_template = "http://{0}.depot.battle.net:1119/{1}.s2mv"
base_url_template = "https://{}-s2-depot.classic.blizzard.com/{}.{}"
url_template = "https://{}-s2-depot.classic.blizzard.com/{}.s2mh"
image_url_template = "https://{}-s2-depot.classic.blizzard.com/{}.s2mv"

#: The name of the map
name = str()
Expand Down
12 changes: 10 additions & 2 deletions sc2reader/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,21 @@ class DepotFile(object):
"""

#: The url template for all DepotFiles
url_template = "https://{0}-s2-depot.classic.blizzard.com/{1}.{2}"
url_template = "https://{}-s2-depot.classic.blizzard.com{}/{}.{}"

def __init__(self, bytes):
#: The server the file is hosted on
self.server = bytes[4:8].decode("utf-8").strip("\x00 ")

# Used to make it possible to load maps from CN.
# This isn't needed for any other region and so is blank by default.
self.url_suffix = ""

# There is no SEA depot, use US instead
if self.server == "SEA":
self.server = "US"
elif self.server == "CN":
self.url_suffix = ".cn"

#: The unique content based hash of the file
self.hash = binascii.b2a_hex(bytes[8:]).decode("utf8")
Expand All @@ -39,7 +45,9 @@ def __init__(self, bytes):
@property
def url(self):
"""Returns url of the depot file."""
return self.url_template.format(self.server, self.hash, self.type)
return self.url_template.format(
self.server, self.url_suffix, self.hash, self.type
)

def __hash__(self):
return hash(self.url)
Expand Down