This program automates the process of downloading a Counter-Strike 2 demo, analyzing it, recording highlights of a specified player, and uploading the resulting video to YouTube. It runs as a continuous service with a web interface for queuing jobs, making it a complete, hands-free pipeline.
This project uses the command-line tools provided by CS Demo Manager to handle the demo analysis and launch the game for recording.
- Web Interface: A simple web UI to queue up demos using a share code and Steam64 ID.
- Automated Queue: The program runs continuously, processing demos from the queue one by one.
- Demo Downloading: Automatically fetches and unzips demos from Valve's servers using the CSReplay.xyz API.
- CLI-Powered Analysis: Uses the official CSDM command-line tools for reliable demo analysis.
- Headless Recording: Launches CS2 via the CSDM CLI to play highlights, which can be recorded by an external program like OBS.
- YouTube Upload: Automatically uploads the final video to a specified YouTube channel.
- Persistent Results: Saves a history of completed jobs in a local
results.jsonfile. - Password Protection: The web interface is protected by a simple password.
- Python 3.7+: Ensure Python is installed and added to your system's PATH.
- Node.js: The CSDM CLI tools require Node.js. Download and install it from nodejs.org.
- Modified CS Demo Manager (Project): IMPORTANT: This script requires a modified version of the CS Demo Manager project with a working highlights CLI feature. You cannot use the official repository directly. You must clone the specific version provided for this project. https://github.com/norton62/cs-demo-manager
- OBS Studio: For recording. Download from obsproject.com.
- Clone This Repository: Download or clone this project to your local machine.
- Install Python Dependencies: Open a terminal in the project folder and run:
pip install -r requirements.txt
- Install CSDM Project Dependencies:
- Navigate to your cloned modified CSDM project folder.
- Run
npm installto install all the necessary Node.js packages.
- Create
config.ini: Rename theconfig.ini.templatefile toconfig.ini. - Edit
config.ini: Open the newconfig.inifile and fill in all the required paths and settings. Comments in the file will guide you. This is the most important step.
You must configure OBS to work with the script.
- Install the
obs-websocketplugin from its GitHub releases page. - In OBS, go to Tools -> obs-websocket Settings.
- Enable the WebSocket server.
- Uncheck "Enable Authentication".
- Note the port (usually
4455) and ensure it matches yourconfig.ini. - Create a scene in OBS with a "Game Capture" source set to "Capture any fullscreen application".
- Go to File -> Settings -> Output -> Recording and set the "Recording Path" to the exact same folder you specified for
output_folderin yourconfig.ini.
To upload videos, you need Google API credentials.
- Go to the Google Cloud Console and create a new project.
- Enable the "YouTube Data API v3".
- Create an OAuth 2.0 Client ID for a Desktop app.
- Download the credentials JSON file, rename it to
client_secrets.json, and place it in the root of this project folder. - Run the authorization script from your terminal:
This will open a browser window for you to authorize the application. A
python setup_youtube_auth.py
token.jsonfile will be created.
- Start the CSDM Dev Server:
- Open a terminal and navigate to your modified CSDM project folder.
- Run the command:
node scripts/develop-cli.mjs - Leave this terminal running in the background.
- Start OBS Studio:
- Open OBS and leave it running in the background.
- Start the Main Program:
- Open a second terminal and navigate to this project's folder.
- Run the main script:
python main.py
- Access the Web Interface:
- Open your web browser and go to
http://localhost:5001. - Log in with the password you set in
config.ini. - You can now start adding demos to the queue.
- Open your web browser and go to