Practical examples for using galaxy-dl.
- Authentication Required: Run
list_library.pyfirst to authenticate - Each example demonstrates specific functionality
- All examples include helpful prompts and error handling
Browse your GOG library
Shows how to:
- Authenticate with GOG
- List all owned games
- Get detailed information for each game
- Display available platforms and extras
python examples/list_library.pyInteractive build selector
Shows how to:
- List all available builds for a game
- Display V1 vs V2 generation info
- Let user select from builds list
- Get manifest efficiently using
get_manifest_from_build()
python examples/build_selection.pyAccess delisted builds using gogdb.org
Shows how to:
- Use repository_id from gogdb.org for V1 builds
- Use manifest links for V2 builds
- Access builds without querying builds API
- Handle delisted/removed builds
python examples/delisted_builds.pyDownload offline installers and extras - NEW
Shows how to:
- Get game details with download information
- List available installers and extras
- Download offline installers (.exe, .sh, .pkg)
- Download bonus content (manuals, wallpapers, soundtracks)
- Verify downloads with MD5 checksums
python examples/download_web.py 1207658924See ../docs/WEB_DOWNLOADER.md for complete documentation.
Note: Get build information from gogdb.org for delisted builds.
Complete download workflow
Shows the full process:
- Browse your game library
- Select a game
- Choose platform
- Select build
- Get manifest
- Download files
python examples/download_game.pyV1 Download - Two Approaches
Shows both V1 download methods:
- Download whole main.bin blob - Fastest for complete game, large file
- Extract individual files - Range requests from main.bin, selective download
python examples/v1_download.pyUse Cases:
- Blob mode: Download entire game quickly, extract files later
- File mode: Download only specific files (e.g., .exe, .dll)
V2 Download - Two Approaches
Shows both V2 download methods:
- Raw chunks - Save compressed ~10MB chunks without decompression
- Processed files - Download, decompress, and assemble into game files
python examples/v2_download.pyUse Cases:
- Raw mode: Cache chunks for faster reinstalls, custom processing
- Processed mode: Direct installation, files ready immediately
Complete 1:1 CDN Archival
Downloads everything in original format for archival/mirroring:
- Depot/Repository JSONs (as served from CDN)
- Manifest JSONs (as served from CDN)
- All chunks/blobs (original CDN format)
- Directory structure mirrors CDN URL paths exactly
# V2 build
python examples/archive_game.py v2 <game_id> <build_id> [game_name]
# V1 build
python examples/archive_game.py v1 <game_id> <repository_id> [game_name]Examples:
python examples/archive_game.py v2 1207658930 92ab42631ff4742b309bb62c175e6306 "The Witcher 2"
python examples/archive_game.py v1 1207658930 37794096 "The Witcher 2"V2 Directory Structure (mirrors CDN /content-system/v2/...):
The Witcher 2/
└── v2/
├── meta/
│ ├── 92/ab/92ab42631ff4742b309bb62c175e6306 # Depot (zlib compressed)
│ ├── 79/a1/79a1f5fd67f6d0cda22c51f1bd706b31 # Manifest (zlib compressed)
│ └── ... # All manifests
├── store/
│ ├── 2e/0d/2e0dc2f5707ec0d88d570240ba918bb2 # Chunk (zlib compressed)
│ └── ... # All chunks
└── debug/
├── 92ab42631ff4742b309bb62c175e6306_depot.json # Human-readable depot
├── 79a1f5fd67f6d0cda22c51f1bd706b31_manifest.json # Human-readable manifest
└── ... # All decompressed JSONs
V1 Directory Structure (mirrors CDN /content-system/v1/...):
The Witcher 2/
└── v1/
└── manifests/
└── 1207658930/ # Game ID
└── windows/ # Platform
└── 37794096/ # Repository ID
├── repository.json # Plain JSON
└── 463cd4b2-783e-447a-b17e-a68d601911e3.json # Manifest UUID
CDN File Formats:
- V2: NO file extensions, all content is zlib compressed
- Debug folder: Human-readable decompressed JSONs with type suffixes (
_depot.json,_manifest.json)
- Debug folder: Human-readable decompressed JSONs with type suffixes (
- V1:
.jsonextensions, plain JSON (no compression, already human-readable) - Paths match exactly what appears after
content-systemin CDN URLs
Use Cases:
- Legal archival/preservation - Save games exactly as distributed
- Offline CDN mirror - Create local replica for reinstalls
- Integrity verification - Validate using manifest hashes
- Custom extraction tools - Process raw data with your own code
python examples/v2_download.py
**Use Cases:**
- **Raw mode**: Cache chunks for faster reinstalls, custom processing
- **Processed mode**: Direct installation, files ready immediately
---
## Common Patterns
### Authenticating
```python
from galaxy_dl import AuthManager
auth = AuthManager()
if not auth.is_authenticated():
# Get code from GOG OAuth URL
code = input("Enter OAuth code: ")
auth.login_with_code(code)
from galaxy_dl import GalaxyAPI
api = GalaxyAPI(auth)
game_ids = api.get_owned_games()
games = api.get_owned_games_with_details(limit=10)# Get ALL builds (recommended)
builds = api.get_all_product_builds(product_id, "windows")
# User selects from list
selected_build = builds["items"][0]
# Get manifest efficiently
manifest = api.get_manifest_from_build(product_id, selected_build)from galaxy_dl import GalaxyDownloader
downloader = GalaxyDownloader(api, max_workers=8)
# Download with progress
def progress(downloaded, total):
print(f"Progress: {downloaded}/{total}")
path = downloader.download_item(
item,
output_dir="./downloads",
progress_callback=progress
)- Use
get_all_product_builds()- Queries both generation endpoints to get all builds - Use
get_manifest_from_build()- More efficient when user selects from list - Use
get_manifest_direct()- For delisted builds with gogdb.org data - Check gogdb.org - For repository IDs and historical build data
- Multi-threading - Both V1 and V2 downloads use parallel workers
- API Reference - Complete API documentation
- README - Library overview
- GENERATION_DETECTION.md - Understanding V1 vs V2
- DELISTED_BUILDS.md - Accessing delisted builds