Tool to use the Call of Duty API
You can find an API description in the docs directory.
Table of contents
- Basic usage
- Commands
To access all the data about an account you need the username, the plateform, an Activision account (can be another account) and that the account allowes viewing stats by the other account.
Login to the Activision servers using this command:
PS> .\cod_login.ps1
It will prompt you the credentials of the Activision account, if everything is ok, a login_data.json
file will be created.
Choose the script to use the data, here for the game Call Of Duty: Black Ops 4, .\fetch_game_data.ps1.
Use this command to get the account data:
PS> .\fetch_game_data.ps1 -UserName MyUsername -Platform MyPlatform
The parameters are:
MyUsername
The username of the account, for example mine is ATE48MyPlatform
The username of the account, for example mine is xbl, you can choose between:xbl
- Xbox Livebattle
- BattleNetsteam
- Steam (Not working with BO4)psn
- PlayStation Network
My command for my account is for example
PS> .\fetch_game_data.ps1 -UserName ATE48 -Platform xbl
The json files are in the directory output_account/<game>/<plateform>_<username>_<mode>.json
For BO4 you can get some information like:
- All the modes
- data.mp.level - the current level (between 1 and 55)
- data.mp.paragonRank - the current master prestige level (between 56 and 1000)
- data.mp.prestige - the current prestige
- (mp.json)
- data.mp.lifetime.all.wlRatio - Win/Lose ratio
- data.mp.lifetime.all.ekiadRatio - EKIA/Death ratio
- data.mp.lifetime.all.kdRatio - Kill/Death ratio
- data.mp.lifetime.all.statsMultikillMoreThan7 - Number of kill chains (1 = dark ops)
- data.mp.lifetime.all.killstreak30NoScorestreaks - Number of nukes in FFA (1 = dark ops)
- (blackout.json)
- data.mp.lifetime.all.winsWithoutKills - Wins without kill (1 = challenge)
- data.mp.lifetime.all.topXPlacementPlayer - Number of top X alone (X can be 5, 10 or 25)
- data.mp.lifetime.all.topXPlacementTeam - Number of top X in team (X can be 5, 10 or 25)
- data.mp.lifetime.all.basketsMade - Baskets made using the Basketball (1 = dark ops)
- data.mp.lifetime.itemData.misc.basketball.kills - Kills made using the Basketball (lmao)
- (zombies.json)
- data.mp.lifetime.all.highestRoundReached - Max round
- data.mp.lifetime.all.bgbsChewed - Elixirs drunk (100 = challenge)
- data.mp.lifetime.all.talismanUsed - Talisman used (50 = challenge)
- data.mp.lifetime.all.deaths - Number of death
- data.mp.lifetime.all.kills - Number of kills (1M = Dark ops)
.\fetch_icons.ps1
Export icons from the CDN
.\fetch_icons.ps1 [[-ExportPath] <String>] [-CwIcons] [-MwIcons] [-Bo4Icons] [-WwiiIcons] [-OnlyPrestiges] [-AllGames] [-LittleIcons] [<CommonParameters>]
Export the CoD Prestige/Level icons from the CDN
-
-ExportPath <String>
The path where to save the icons -
-CwIcons
Download Black ops Cold War icons, included in AllGames -
-MwIcons
Download Modern Warfare 2019 icons, included in AllGames -
-Bo4Icons
Download Black ops 4 icons, included in AllGames -
-WwiiIcons
Download World War II icons, included in AllGames -
-OnlyPrestiges
Only download the prestige icons -
-AllGames
Download all the icons from each games -
-LittleIcons
Download non large icons (if available)
PS > .\fetch_icons.ps1 -AllGames
.\cod_login.ps1
Login to the Activision API
.\cod_login.ps1 [[-Username] <String>] [[-Password] <SecureString>] [[-SaveFile] <String>] [-ReturnLoginInformation] [<CommonParameters>]
Login to the Activision API and return login data into a file or in the pipeline
-
-Username <String>
The email/username to connect to your Activision account -
-Password <SecureString>
ASecureString
of your password to connect -
-SaveFile <String>
By default "login_data.json", where the login data are saved, useless if the -ReturnLoginInformation is set -
-ReturnLoginInformation
Return the login information into the pipeline
PS> $pass = Read-Host -AsSecureString
******************
PS> .\cod_login.ps1 -Username "mymail@example.org" -Password $pass
Register DEVICE_ID '****'...
Login...
Writing login tokens into 'login_data.json'
.\build_sso_websession.ps1
Build a session from the cod_login.ps1 output
.\build_sso_websession.ps1 [[-loginData] <Object>] [[-SaveFile] <String>] [[-CookieDomain] <String>] [<CommonParameters>]
Build a session from the cod_login.ps1 output
-
-loginData <Object>
Login data object, returned by cod_login.ps1 using the -ReturnLoginInformation switch -
-SaveFile <String>
Login save file, returned by default by cod_login.ps1 without using the -ReturnLoginInformation switch -
-CookieDomain <String>
The domain to match the cookies of the WebSession
PS> # cod_login.ps1 was already executed and a login_data.json file exists
PS> .\build_sso_websession.ps1
Headers : {[Authorization, bearer ****], [X_COD_DEVICE_ID, ****]}
Cookies : System.Net.CookieContainer
UseDefaultCredentials : False
Credentials :
Certificates :
UserAgent : cod-ate-worker
Proxy :
MaximumRedirection : -1
MaximumRetryCount : 0
RetryIntervalInSeconds : 0
.\fetch_game_data.ps1
Fetch Call of Duty stats of a player
.\fetch_game_data.ps1 [[-UserName] <String>] [[-Platform] <String>] [[-Session] <Object>] [<CommonParameters>]
Fetch Call of Duty stats of a player and output json, can fail if the user doesn't allow the share of his stats with the other
-
-UserName <String>
The username of the player -
-Platform <String> = "xbl", "battle", "steam", "psn"
The platform of the user -
-Title <String> = "bo4", "bo3", "cw", "mw", "iw", "ww2"
The title to fetch, by default Cold War (cw) -
-Session <Object>
The session to connect, null to generate a new one
PS>.\fetch_game_data.ps1 -UserName ATE48 -Platform xbl -Title bo4
Saving data https://my.callofduty.com/api/papi-client/crm/cod/v2/title/bo4/platform/xbl/gamer/ATE48/profile/type/mp/ to output_account/xbl_ATE48_mp.json...
Saving data https://my.callofduty.com/api/papi-client/crm/cod/v2/title/bo4/platform/xbl/gamer/ATE48/profile/type/blackout/ to output_account/xbl_ATE48_blackout.json...
Saving data https://my.callofduty.com/api/papi-client/crm/cod/v2/title/bo4/platform/xbl/gamer/ATE48/profile/type/zombies/ to output_account/xbl_ATE48_zombies.json...
.\fetch_items_icons.ps1
Fetch game items icon from JSON data
.\fetch_items_icons.ps1 [-OutputAccountPath] <String[]> [-ExportPath <String>] [<CommonParameters>]
Fetch game items icon from JSON data
-
-OutputAccountPath <String[]>
The json files -
-ExportPath <String>
The path where to save the icons
PS >.\fetch_items_icons.ps1 -OutputAccountPath ".\output_account\bo4\*_ATE48_*"
Downloading https://www.callofduty.com/cdn/app/icons/bo4/combatrecord/eq_acid_bomb.png into output_icons/bo4/items/equipment/eq_acid_bomb.png...
.\fetch_maps_icons.ps1
Fetch game maps icon from JSON data
.\fetch_maps_icons.ps1 [-OutputAccountPath] <String[]> [-ExportPath <String>] [<CommonParameters>]
Fetch game items icon from JSON data
-
-OutputAccountPath <String[]>
The json files -
-ExportPath <String>
The path where to save the icons
PS >.\fetch_maps_icons.ps1 -OutputAccountPath ".\output_account\bo4\*_ATE48_*"
Downloading https://www.callofduty.com/cdn/app/base-maps/bo4/mp_casino.jpg into output_icons/bo4/mp_casino.jpg...
Downloading https://www.callofduty.com/cdn/app/base-maps/bo4/mp_elevation.jpg into output_icons/bo4/mp_elevation.jpg...
Downloading https://www.callofduty.com/cdn/app/base-maps/bo4/mp_firingrange2.jpg into output_icons/bo4/mp_firingrange2.jpg...
Downloading https://www.callofduty.com/cdn/app/base-maps/bo4/mp_frenetic.jpg into output_icons/bo4/mp_frenetic.jpg...
.\download_maps_icons.ps1
Download all the maps icon from the CDN
.\download_maps_icons.ps1 [[-Title] <Object>] [[-ExportPath] <String>] [-PrintNames] [<CommonParameters>]
Download all the maps icon from the CDN