@@ -914,8 +914,6 @@ def __getstate__(self):
914914
915915
916916class Map (Resource ):
917- url_template = "https://{}-s2-depot.classic.blizzard.com/{}.s2ma"
918-
919917 def __init__ (self , map_file , filename = None , region = None , map_hash = None , ** options ):
920918 super (Map , self ).__init__ (map_file , filename , ** options )
921919
@@ -998,9 +996,7 @@ def __init__(self, map_file, filename=None, region=None, map_hash=None, **option
998996 def get_url (cls , region , map_hash ):
999997 """Builds a download URL for the map from its components."""
1000998 if region and map_hash :
1001- # it seems like sea maps are stored on us depots.
1002- region = "us" if region == "sea" else region
1003- return cls .url_template .format (region , map_hash )
999+ return utils .get_resource_url (region , hash , "s2ma" )
10041000 else :
10051001 return None
10061002
@@ -1021,8 +1017,6 @@ class GameSummary(Resource):
10211017 that the data is not necessarily in the places we expect.
10221018 """
10231019
1024- url_template = "https://{}-s2-depot.classic.blizzard.com/{}.s2gs"
1025-
10261020 #: Game speed
10271021 game_speed = str ()
10281022
@@ -1450,10 +1444,6 @@ def __str__(self):
14501444class MapHeader (Resource ):
14511445 """**Experimental**"""
14521446
1453- base_url_template = "https://{}-s2-depot.classic.blizzard.com/{}.{}"
1454- url_template = "https://{}-s2-depot.classic.blizzard.com/{}.s2mh"
1455- image_url_template = "https://{}-s2-depot.classic.blizzard.com/{}.s2mv"
1456-
14571447 #: The name of the map
14581448 name = str ()
14591449
@@ -1488,21 +1478,21 @@ def __init__(self, header_file, filename=None, **options):
14881478 # Parse image hash
14891479 parsed_hash = utils .parse_hash (self .data [0 ][1 ])
14901480 self .image_hash = parsed_hash ["hash" ]
1491- self .image_url = self . image_url_template . format (
1492- parsed_hash ["server" ], parsed_hash ["hash" ]
1481+ self .image_url = utils . get_resource_url (
1482+ parsed_hash ["server" ], parsed_hash ["hash" ], "s2mv"
14931483 )
14941484
14951485 # Parse map hash
14961486 parsed_hash = utils .parse_hash (self .data [0 ][2 ])
14971487 self .map_hash = parsed_hash ["hash" ]
1498- self .map_url = self . base_url_template . format (
1488+ self .map_url = utils . get_resource_url (
14991489 parsed_hash ["server" ], parsed_hash ["hash" ], parsed_hash ["type" ]
15001490 )
15011491
15021492 # Parse localization hashes
15031493 l18n_struct = self .data [0 ][4 ][8 ]
15041494 for l in l18n_struct :
15051495 parsed_hash = utils .parse_hash (l [1 ][0 ])
1506- self .localization_urls [l [0 ]] = self . base_url_template . format (
1496+ self .localization_urls [l [0 ]] = utils . get_resource_url (
15071497 parsed_hash ["server" ], parsed_hash ["hash" ], parsed_hash ["type" ]
15081498 )
0 commit comments