mirror of
https://github.com/Ahrimdon/detailed-cod-tracker.git
synced 2025-04-30 02:44:47 -04:00
Compare commits
No commits in common. "main" and "v3.0.0" have entirely different histories.
214
README.md
214
README.md
@ -1,134 +1,136 @@
|
|||||||
# Modern Warfare 2019 Advanced Statistics Tracker
|
# Modern Warfare 2019 Detailed Statistic Tracker
|
||||||
|
|
||||||
Access comprehensive Call of Duty statistics directly from your command line. No more visiting third-party tracking websites when you can retrieve **every statistic** Call of Duty records in under a minute.
|
Tired of visiting [cod.tracker.gg](https://cod.tracker.gg/modern-warfare) to check your player stats? With this repository, you'll never have to visit that site again.
|
||||||
|
|
||||||
> View example outputs in the `/examples/` directory
|
Get every single statistic Call of Duty <u>***tracks***</u> in one place, under a minute!
|
||||||
|
|
||||||
|
> To see an example, look in `/examples/`
|
||||||
|
|
||||||
|
## Table of Contents
|
||||||
|
- [Features](#features)
|
||||||
|
- [Prerequisites](#prerequisites)
|
||||||
|
- [Installation](#installation)
|
||||||
|
- [Using the Latest Release **(Easiest)**](#using-the-latest-release-easiest)
|
||||||
|
- [Cloning the Repository](#cloning-the-repository)
|
||||||
|
- [Obtaining your ACT\_SSO\_COOKIE](#obtaining-your-act_sso_cookie)
|
||||||
|
- [Obtaining Your userInfo.json File](#obtaining-your-userinfojson-file)
|
||||||
|
- [Command Line Arguments](#command-line-arguments)
|
||||||
|
- [Command Examples](#command-examples)
|
||||||
|
- [Sorting](#sorting)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
- Instantly download detailed statistics for any player, including ***Lifetime Statistics***, ***Match Statistics*** and ***season_loot***
|
||||||
- **Complete Statistics Access**: Download detailed player statistics including lifetime stats, match history, and seasonal rewards
|
- Download a list of all maps and game modes in current rotation
|
||||||
- **Enhanced Sorting**: Sort statistics more effectively than the in-game Barracks
|
- Convert match start times, end times, and duration to human readable formats
|
||||||
- **Human-Readable Formats**: Convert timestamps and code names to user-friendly formats
|
- [**Sort**](#sorting) your statistics even better than the in-game Barracks does!
|
||||||
- **Detailed Match History**: Split match data into separate files for easier analysis
|
- Split detailed match data into separate files from most recent to least recent for easy viewing
|
||||||
- **Game Information**: Access lists of all maps and game modes in current rotation
|
- Convert all code names for weapons, killstreaks, equipment, etc. to human-readable strings
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
- Call of Duty Account
|
||||||
|
- Account API security settings set to open
|
||||||
|
- `Python 3.x` *(optional)* (Tested with Python 3.9.13)
|
||||||
|
- A Web Browser *(Tested with Chromium)*
|
||||||
|
- ~~[Curl](https://curl.se/download.html) ***(Installed by default on Windows)***~~
|
||||||
|
|
||||||
- Call of Duty account with API security settings set to "Open"
|
## Installation
|
||||||
- Web browser (Chromium-based recommended)
|
#### Using the Latest Release **(Easiest)**
|
||||||
- Python 3.x (optional, tested with Python 3.9.13)
|
- Navigate to the latest release and download `cod_api_tool.exe`
|
||||||
|
- Open a command line of your choise, navigate to the directory using `cd` and follow examples below
|
||||||
## Installation Options
|
|
||||||
|
|
||||||
### Option 1: Download the Latest Release (Recommended)
|
|
||||||
|
|
||||||
1. Download `cod_api_tool.exe` from the [latest release](https://github.com/Ahrimdon/detailed-cod-tracker/releases/latest)
|
|
||||||
2. Open a command prompt in the download directory
|
|
||||||
3. Execute the tool using the syntax below:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
cod_api_tool.exe [arguments]
|
cd "C:\Users\John\Desktop\detailed-cod-tracker"
|
||||||
|
|
||||||
|
cod_api_tool.exe [-h] [-p PLAYER_NAME] [-a] [-sl] [-id] [-m] [-i] [-f] [-e] [-cp] [-ca] [-s] [-c] [-sm] [-csd] [-cmd] [-cff] [-cef]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Option 2: Clone the Repository
|
#### Cloning the Repository
|
||||||
|
- Download the ZIP archive or clone the repository `git clone https://github.com/Ahrimdon/detailed-cod-tracker.git && cd detailed-cod-tracker`
|
||||||
|
- Run the setup using the command `python setup.py`.
|
||||||
|
|
||||||
1. Clone the repository:
|
## Obtaining your ACT_SSO_COOKIE
|
||||||
|
- Go to https://www.callofduty.com and login with your account
|
||||||
|
- Once logged in, press `F12` for your browsers developer tools. Then go to Application --> Storage -->
|
||||||
|
|
||||||
|
Cookies --> https://www.callofduty.com/ --> ACT_SSO_COOKIE
|
||||||
|
- Enter the value when prompted
|
||||||
|
|
||||||
|
## Obtaining Your userInfo.json File
|
||||||
|
- For some reason, Activision broke the userInfo API URL which in turn, broke the API Wrapper's logic to obtain certain user information. Unfortunately, this also means we also cannot use Curl. Follow the steps below if you wish to obtain General Info, friendFeed, eventFeed, Cod Point Balance, Connected Accounts, and Account Settings.
|
||||||
|
|
||||||
|
1. Clone the repository, `git clone https://github.com/Ahrimdon/detailed-cod-tracker.git && cd detailed-cod-tracker`
|
||||||
|
2. Obtain your [*ACT_SSO_COOKIE*](#obtaining-your-act_sso_cookie)
|
||||||
|
3. Go to `https://profile.callofduty.com/cod/userInfo/{ACT_SSO_COOKIE}` and copy the contents into `userInfo.json` in the repo's directory
|
||||||
|
> *Note:* Create the `userInfo.json` file manually
|
||||||
|
4. In the newly created `userInfo.json`, delete "*userInfo(*" and "*);*" at the beginning and end of the file. Alternatively, you can find and replace using the regular expression inside `sanitize_userInfo_regex.txt`
|
||||||
|
5. Run `cod_api_tool.py` using the `-a` argument (e.g. `python cod_api_tool.py -p Ahrimdon -a`)
|
||||||
|
|
||||||
|
If done correctly, this should return the extra API information.
|
||||||
|
|
||||||
|
## Command Line Arguments
|
||||||
```
|
```
|
||||||
git clone https://github.com/Ahrimdon/detailed-cod-tracker.git
|
usage: cod_api_tool.py [-h] [-p PLAYER_NAME] [-a] [-sl] [-id] [-m] [-i] [-f] [-e] [-cp] [-ca] [-s] [-c] [-sm] [-csd] [-cmd] [-cff] [-cef]
|
||||||
cd detailed-cod-tracker
|
|
||||||
|
Detailed Modern Warfare (2019) Statistics Tool
|
||||||
|
|
||||||
|
optional arguments:
|
||||||
|
-h, --help show this help message and exit
|
||||||
|
|
||||||
|
Data Fetching Options:
|
||||||
|
-p PLAYER_NAME, --player_name PLAYER_NAME
|
||||||
|
Player's username (with #1234567)
|
||||||
|
-a, --all_stats Fetch all the different types of stats data
|
||||||
|
-sl, --season_loot Fetch only the season loot data
|
||||||
|
-id, --identities Fetch only the logged-in identities data
|
||||||
|
-m, --maps Fetch only the map list data
|
||||||
|
-i, --info Fetch only general information
|
||||||
|
-f, --friendFeed Fetch only your friend feed
|
||||||
|
-e, --eventFeed Fetch only your event feed
|
||||||
|
-cp, --cod_points Fetch only your COD Point balance
|
||||||
|
-ca, --connected_accounts
|
||||||
|
Fetch only the map list data
|
||||||
|
-s, --settings Fetch only your account settings
|
||||||
|
|
||||||
|
Data Cleaning Options:
|
||||||
|
-c, --clean Beautify all data
|
||||||
|
-sm, --split_matches Split the matches into separate JSON files within the 'matches' subfolder
|
||||||
|
-csd, --clean_stats_data
|
||||||
|
Beautify the data and convert to human-readable strings in stats.json
|
||||||
|
-cmd, --clean_match_data
|
||||||
|
Beautify the match data and convert to human-readable strings in match_info.json
|
||||||
|
-cff, --clean_friend_feed
|
||||||
|
Clean the friend feed data
|
||||||
|
-cef, --clean_event_feed
|
||||||
|
Clean the event feed data
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Run the setup script:
|
## Command Examples
|
||||||
|
**Gather Player's Lifetime Statistics & 20 Recent Games**
|
||||||
```
|
```
|
||||||
python setup.py
|
cod_api_tool.exe -p Ahrimdon#1234567
|
||||||
```
|
```
|
||||||
|
|
||||||
## Authentication Setup
|
**Sort, clean, and organize all data**
|
||||||
|
|
||||||
### Obtaining your ACT_SSO_COOKIE
|
|
||||||
|
|
||||||
1. Log in to [Call of Duty](https://www.callofduty.com)
|
|
||||||
2. Open developer tools (F12)
|
|
||||||
3. Navigate to: Application → Storage → Cookies → https://www.callofduty.com/
|
|
||||||
4. Copy the value of `ACT_SSO_COOKIE`
|
|
||||||
5. Provide this value when prompted by the tool
|
|
||||||
|
|
||||||
### Setting up userInfo.json (Required for Advanced Features)
|
|
||||||
|
|
||||||
Due to recent API changes, additional steps are required for certain features:
|
|
||||||
|
|
||||||
1. Navigate to `https://profile.callofduty.com/cod/userInfo/{ACT_SSO_COOKIE}` (replace with your actual cookie)
|
|
||||||
2. Copy the entire content
|
|
||||||
3. Create a file named `userInfo.json` in the tool's directory
|
|
||||||
4. Paste the content and remove `userInfo(` from the beginning and `);` from the end
|
|
||||||
- Alternatively, use the regex pattern in `sanitize_userInfo_regex.txt`
|
|
||||||
5. Run the tool with the `-a` flag to access advanced features
|
|
||||||
|
|
||||||
## Command Line Reference
|
|
||||||
|
|
||||||
```
|
```
|
||||||
usage: cod_api_tool.py [-h] [-tz {GMT,EST,CST,PST}] [-p PLAYER_NAME] [-a]
|
cod_api_tool.exe -c
|
||||||
[-sl] [-id] [-m] [-i] [-f] [-e] [-cp] [-ca] [-s] [-c]
|
|
||||||
[-sm] [-csd] [-cmd] [-cff] [-cef]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Default Options
|
**Split matches into separate files**
|
||||||
| Argument | Description |
|
|
||||||
|----------|-------------|
|
|
||||||
| `-h`, `--help` | Show help message and exit |
|
|
||||||
| `-tz`, `--timezone` | Specify timezone (GMT, EST, CST, PST) |
|
|
||||||
|
|
||||||
### Data Fetching Options
|
|
||||||
| Argument | Description |
|
|
||||||
|----------|-------------|
|
|
||||||
| `-p PLAYER_NAME`, `--player_name PLAYER_NAME` | Target player's username (with #1234567) |
|
|
||||||
| `-a`, `--all_stats` | Fetch all available statistics |
|
|
||||||
| `-sl`, `--season_loot` | Fetch only seasonal reward data |
|
|
||||||
| `-id`, `--identities` | Fetch only logged-in identities data |
|
|
||||||
| `-m`, `--maps` | Fetch only map list data |
|
|
||||||
| `-i`, `--info` | Fetch only general information |
|
|
||||||
| `-f`, `--friendFeed` | Fetch only friend feed |
|
|
||||||
| `-e`, `--eventFeed` | Fetch only event feed |
|
|
||||||
| `-cp`, `--cod_points` | Fetch only COD Point balance |
|
|
||||||
| `-ca`, `--connected_accounts` | Fetch only connected accounts data |
|
|
||||||
| `-s`, `--settings` | Fetch only account settings |
|
|
||||||
|
|
||||||
### Data Processing Options
|
|
||||||
| Argument | Description |
|
|
||||||
|----------|-------------|
|
|
||||||
| `-c`, `--clean` | Beautify all data |
|
|
||||||
| `-sm`, `--split_matches` | Split matches into separate JSON files |
|
|
||||||
| `-csd`, `--clean_stats_data` | Beautify stats.json data |
|
|
||||||
| `-cmd`, `--clean_match_data` | Beautify match_info.json data |
|
|
||||||
| `-cff`, `--clean_friend_feed` | Clean friend feed data |
|
|
||||||
| `-cef`, `--clean_event_feed` | Clean event feed data |
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
**Basic Usage: Retrieve Player Statistics**
|
|
||||||
```
|
```
|
||||||
cod_api_tool.exe -p YourUsername#1234567
|
cod_api_tool.exe -sm
|
||||||
```
|
```
|
||||||
|
|
||||||
**Full Data Collection with Cleaning**
|
**Gather all data**
|
||||||
```
|
```
|
||||||
cod_api_tool.exe -p YourUsername#1234567 -a -c -sm
|
cod_api_tool.exe -p Ahrimdon#1234567 -a
|
||||||
```
|
```
|
||||||
|
|
||||||
**Process Existing Data**
|
> All data is saved to `/stats/`
|
||||||
```
|
|
||||||
cod_api_tool.exe -c -sm
|
|
||||||
```
|
|
||||||
|
|
||||||
> All data is saved to the `/stats/` directory
|
## Sorting
|
||||||
|
* Game Modes are sorted by *Time Played* in descending order
|
||||||
## Advanced Sorting
|
* Weapons are sorted by *Kills* in descending order
|
||||||
|
* Field Upgrades are sorted by *Uses* in descending order
|
||||||
The tool offers enhanced sorting capabilities:
|
* Lethal and Tactical equipment are sorted by *Uses* in descending order
|
||||||
|
* Lethal and Support Scorestreaks by *Times Awarded* in descending order
|
||||||
- Game modes sorted by **Time Played** (descending)
|
* Accolades sorted in descending order
|
||||||
- Weapons sorted by **Kills** (descending)
|
|
||||||
- Field upgrades sorted by **Uses** (descending)
|
|
||||||
- Equipment (lethal and tactical) sorted by **Uses** (descending)
|
|
||||||
- Scorestreaks sorted by **Times Awarded** (descending)
|
|
||||||
- Accolades sorted in descending order
|
|
@ -121,7 +121,7 @@ class CodStatsManager:
|
|||||||
self.save_to_file(identities_data, 'identities.json')
|
self.save_to_file(identities_data, 'identities.json')
|
||||||
|
|
||||||
# Check if userInfo.json exists to determine if we should fetch additional data
|
# Check if userInfo.json exists to determine if we should fetch additional data
|
||||||
user_info_file = os.path.join('userInfo.json')
|
user_info_file = os.path.join(STATS_DIR, 'userInfo.json')
|
||||||
if os.path.exists(user_info_file):
|
if os.path.exists(user_info_file):
|
||||||
# Additional user data
|
# Additional user data
|
||||||
info = api.Me.info()
|
info = api.Me.info()
|
||||||
@ -129,7 +129,13 @@ class CodStatsManager:
|
|||||||
event_feed = api.Me.eventFeed()
|
event_feed = api.Me.eventFeed()
|
||||||
cod_points = api.Me.codPoints()
|
cod_points = api.Me.codPoints()
|
||||||
connected_accounts = api.Me.connectedAccounts()
|
connected_accounts = api.Me.connectedAccounts()
|
||||||
|
|
||||||
|
try:
|
||||||
settings = api.Me.settings()
|
settings = api.Me.settings()
|
||||||
|
# Make sure settings is JSON serializable
|
||||||
|
self.save_to_file(self._ensure_json_serializable(settings), 'settings.json')
|
||||||
|
except TypeError as e:
|
||||||
|
print(f"Warning: Could not save settings due to serialization error: {e}")
|
||||||
|
|
||||||
# Save additional data
|
# Save additional data
|
||||||
self.save_to_file(info, 'info.json')
|
self.save_to_file(info, 'info.json')
|
||||||
|
128
setup.py
128
setup.py
@ -1,112 +1,38 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""
|
|
||||||
Setup script for Modern Warfare 2019 Advanced Statistics Tracker.
|
|
||||||
Creates a virtual environment and installs required dependencies.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
|
||||||
import venv
|
import venv
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
|
def deps_exists():
|
||||||
|
return os.path.exists('deps')
|
||||||
|
|
||||||
def check_dependencies():
|
def create_venv():
|
||||||
"""Check if the dependencies directory exists."""
|
venv.create('venv', with_pip=True)
|
||||||
deps_dir = Path('deps')
|
# Create activation scripts
|
||||||
if not deps_dir.exists():
|
with open("venv.ps1", "w") as f:
|
||||||
print("Error: 'deps' directory not found!")
|
f.write("venv\\Scripts\\Activate.ps1")
|
||||||
print("Please ensure the dependencies directory exists before running setup.")
|
|
||||||
sys.exit(1)
|
|
||||||
return deps_dir
|
|
||||||
|
|
||||||
|
with open("venv.bat", "w") as f:
|
||||||
|
f.write("venv\\Scripts\\activate")
|
||||||
|
|
||||||
def create_virtual_environment():
|
def setup_tools():
|
||||||
"""Create and configure a Python virtual environment."""
|
subprocess.check_call([os.path.join('venv', 'Scripts', 'pip'), 'install', '--no-index', '--find-links=deps', 'pip', 'wheel', 'build', 'pyinstaller'])
|
||||||
print("Creating virtual environment...")
|
|
||||||
venv_dir = Path('venv')
|
|
||||||
|
|
||||||
# Create the virtual environment with pip
|
def setup_api():
|
||||||
venv.create(venv_dir, with_pip=True)
|
wheel_path = os.path.join('deps', 'cod_api-2.0.2-py3-none-any.whl')
|
||||||
|
subprocess.check_call([os.path.join('venv', 'Scripts', 'pip'), 'install', '--no-index', '--find-links=deps', wheel_path])
|
||||||
# Create activation scripts for different platforms
|
|
||||||
scripts = {
|
|
||||||
"venv.ps1": "venv\\Scripts\\Activate.ps1",
|
|
||||||
"venv.bat": "venv\\Scripts\\activate",
|
|
||||||
"venv.sh": "source venv/bin/activate" # Added for Unix/Linux users
|
|
||||||
}
|
|
||||||
|
|
||||||
for filename, content in scripts.items():
|
|
||||||
with open(filename, "w") as f:
|
|
||||||
f.write(content)
|
|
||||||
|
|
||||||
return venv_dir
|
|
||||||
|
|
||||||
|
|
||||||
def get_pip_path(venv_dir):
|
|
||||||
"""Get the platform-specific path to pip in the virtual environment."""
|
|
||||||
if sys.platform == 'win32':
|
|
||||||
return venv_dir / 'Scripts' / 'pip'
|
|
||||||
return venv_dir / 'bin' / 'pip'
|
|
||||||
|
|
||||||
|
|
||||||
def install_packages(pip_path, deps_dir):
|
|
||||||
"""Install required packages from the local dependencies directory."""
|
|
||||||
print("Installing base packages...")
|
|
||||||
base_packages = ['pip', 'wheel', 'build', 'pyinstaller']
|
|
||||||
subprocess.check_call([
|
|
||||||
str(pip_path), 'install',
|
|
||||||
'--no-index',
|
|
||||||
f'--find-links={deps_dir}',
|
|
||||||
*base_packages
|
|
||||||
])
|
|
||||||
|
|
||||||
print("Installing COD API package...")
|
|
||||||
cod_api_wheel = 'cod_api-2.0.2-py3-none-any.whl'
|
|
||||||
subprocess.check_call([
|
|
||||||
str(pip_path), 'install',
|
|
||||||
'--no-index',
|
|
||||||
f'--find-links={deps_dir}',
|
|
||||||
str(deps_dir / cod_api_wheel)
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
def clean_environment(pip_path):
|
|
||||||
"""Remove deprecated or conflicting packages."""
|
|
||||||
print("Removing deprecated packages...")
|
|
||||||
deprecated_packages = ['enum34']
|
|
||||||
subprocess.check_call([
|
|
||||||
str(pip_path), 'uninstall', *deprecated_packages, '-y'
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""Main setup function."""
|
|
||||||
print("Starting setup for Modern Warfare 2019 Statistics Tracker...")
|
|
||||||
|
|
||||||
# Check for dependencies directory
|
|
||||||
deps_dir = check_dependencies()
|
|
||||||
|
|
||||||
# Create and configure the virtual environment
|
|
||||||
venv_dir = create_virtual_environment()
|
|
||||||
|
|
||||||
# Get the appropriate pip path
|
|
||||||
pip_path = get_pip_path(venv_dir)
|
|
||||||
|
|
||||||
# Install required packages
|
|
||||||
install_packages(pip_path, deps_dir)
|
|
||||||
|
|
||||||
# Clean up environment
|
|
||||||
clean_environment(pip_path)
|
|
||||||
|
|
||||||
print("\nSetup completed successfully!")
|
|
||||||
print(f"To activate the virtual environment, run:")
|
|
||||||
if sys.platform == 'win32':
|
|
||||||
print(" - PowerShell: .\\venv.ps1")
|
|
||||||
print(" - Command Prompt: venv.bat")
|
|
||||||
else:
|
|
||||||
print(" - Bash/Zsh: source venv.sh")
|
|
||||||
|
|
||||||
|
def remove_deprecated_packages():
|
||||||
|
subprocess.check_call([os.path.join('venv', 'Scripts', 'pip'), 'uninstall', 'enum34', '-y'])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
if not deps_exists():
|
||||||
|
print("Error: 'deps' directory does not exist!")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
print("Creating virtual environment...")
|
||||||
|
create_venv()
|
||||||
|
print("Setting up virtual environment...")
|
||||||
|
setup_tools()
|
||||||
|
setup_api()
|
||||||
|
remove_deprecated_packages()
|
||||||
|
print("Setup completed successfully.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user