How rehmatworks/gplaydl works
1. Project shape
- This is a Python 3.9+ command-line package named gplaydl, not a web service.
- The architecture is centered on a small set of modules under gplaydl/, with packaged static device profile files in gplaydl/profiles/.
- pyproject.toml, requirements.txt, and .github/workflows/publish.yml support packaging and release automation rather than runtime behavior.
2. Entry points
- gplaydl/__main__.py is the module entrypoint for python -m gplaydl.
- gplaydl/cli.py is the main user-facing orchestration layer: it parses commands like auth, download, info, search, and list-splits, then dispatches into the lower-level modules.
- gplaydl/__init__.py marks the package and likely exposes version/package metadata.
3. Command-layer boundary
- The CLI is the top boundary between the user and the system.
- It handles flags such as architecture selection (arm64, armv7), custom token dispenser URLs, output directories, and feature toggles like --no-splits / --no-extras.
- From an architecture perspective, this layer does not own network logic or parsing; it coordinates the auth, metadata, and download subsystems.
4. Anonymous authentication subsystem
- gplaydl/auth.py manages anonymous authentication against Aurora Store’s token dispenser.
- It appears to be responsible for obtaining, caching, clearing, and reusing auth tokens, with separate cached tokens per architecture under the user config directory.
- Token acquisition is improved by rotating through multiple device profiles, which increases compatibility with the dispenser and Google Play.
5. Device profile subsystem
- gplaydl/profiles.py and the gplaydl/profiles/*.properties files form a data-driven device profile library.
- These profiles are static inputs used during authentication; they are not application state.
- The profile set is an important architectural boundary because it decouples auth behavior from code and allows token rotation without changing logic.
6. Google Play metadata and protobuf decoding
- gplaydl/api.py is the main Google Play-facing API client layer.
- gplaydl/protobuf.py indicates that responses are decoded in pure Python rather than via an external gpapi dependency.
- This subsystem is responsible for fetching app details, search results, split metadata, version information, and download authorization details from Google Play’s protobuf-based endpoints.
7. Download orchestration
- gplaydl/download.py is the file-transfer layer.
- It coordinates the actual fetching of APKs from Google Play CDN URLs, likely based on metadata and authorization returned by the API layer.
- The download pipeline includes base APKs, split APKs, OBB expansion files, and Play Asset Delivery packs, with support for streaming gzip decompression for asset packs.
8. End-to-end data flow
- The typical flow is: CLI command → auth token lookup/acquisition → Google Play metadata lookup → purchase/authorization step → download URL resolution → parallel streaming download.
- For download, the CLI first ensures a valid token exists, then resolves the package/version/architecture, then asks the API layer for the files to fetch, and finally hands those URLs to the downloader.
- For info, search, and list-splits, the flow stops after metadata/query retrieval and presentation.
9. External dependencies and service boundaries
- The repo depends on two key external services: Aurora Store’s public token dispenser and Google Play services/CDN.
- Aurora provides anonymous auth tokens; Google Play provides app metadata, purchase authorization, and file delivery.
- The architecture is deliberately split so that dispenser selection is configurable (--dispenser) while Google Play access remains the core downstream dependency.
10. Output and storage model
- Auth tokens are persisted locally in the user config directory and reused automatically, which reduces network chatter and makes the CLI stateful across invocations.
- Downloaded artifacts are written to a user-selected or default output directory using deterministic filenames that encode package name, version code, and split/asset type.
- This naming convention is part of the download boundary and is important for downstream install workflows like adb install-multiple.
11. Packaging and release
- The repository is packaged for installation via pip and also supports execution without installation.
- The GitHub Actions workflow in .github/workflows/publish.yml suggests automated publishing to a package index when releases are made.
- This release tooling is separate from runtime logic and does not affect the execution path of the CLI itself.
12. Useful diagram framing
- A clear architecture diagram should show: user/terminal at the top, cli.py as the orchestrator, auth.py plus profile files as the token-acquisition path, api.py/protobuf.py as the Google Play metadata path, and download.py as the file-transfer path.
- The two external boxes should be Aurora Store token dispenser and Google Play services/CDN, with local token cache as a persistent state node between runs.
Main entry points: cli.py CLI · auth.py Auth · api.py API client · download.py Downloader
Components 16
Runtime
Command-line execution path and core subsystems.
- User · Runs the CLI from a terminal.
- __main__ · Module entrypoint for python -m gplaydl.
gplaydl/__main__.py - CLI · Parses commands and coordinates auth, metadata, and download flows.
gplaydl/cli.py - Package init · Package marker and exported metadata.
gplaydl/__init__.py - Auth · Obtains, caches, clears, and reuses anonymous auth tokens.
gplaydl/auth.py - Profiles · Static device profile library used during auth token rotation.
gplaydl/profiles.py - API client · Fetches metadata, search results, split info, and download authorization.
gplaydl/api.py - Protobuf · Pure-Python decoding of Google Play protobuf responses.
gplaydl/protobuf.py - Downloader · Resolves and streams APK, split, OBB, and asset pack downloads.
gplaydl/download.py - Results · Printed info, search results, and download status.
State
Local persistent cache used across runs.
- Token cache · Per-architecture cached auth tokens in the user config directory.
- Profile files · Packaged .properties device profiles bundled with the repo.
gplaydl/profiles
External services
Remote boundaries the CLI talks to.
- Token dispenser · Public Aurora Store endpoint used to mint anonymous auth tokens.
- Google Play · Metadata, authorization, and CDN file delivery boundary.
Packaging
Build and release support outside the runtime path.
- Publish workflow · GitHub Actions workflow for package publishing.
.github/workflows/publish.yml - Packaging · Project metadata and dependencies for pip installation.
pyproject.toml
Connections 17
- User → __main__: runs · Starts the package via python -m gplaydl.
- __main__ → CLI: dispatches · Entrypoint hands control to the command layer.
- CLI → Auth: auth · Ensures a valid anonymous token before protected actions.
- CLI → API client: query · Requests metadata, search, split, and version information.
- CLI → Downloader: download · Hands resolved file targets to the transfer layer.
- CLI → Results: prints · Outputs command results to the terminal.
- Auth → Profiles: rotate · Uses device profiles to improve token acquisition.
- Auth → Token cache: persist · Stores and reuses tokens between runs.
- Auth → Token dispenser: request · Contacts Aurora Store token dispenser.
- Profiles → Profile files: load · Reads bundled profile definitions.
- API client → Protobuf: decode · Parses protobuf-based Google Play responses.
- API client → Google Play: fetch · Calls Google Play metadata and authorization endpoints.
- Downloader → Google Play: stream · Downloads files from Google Play CDN URLs.
- Downloader → Results: report · Reports progress and completion status.
- CLI → Packaging: package · Runtime is packaged as a pip-installable project.
- Packaging → Publish workflow: release · GitHub Actions publishes packaged releases.
- Package init → CLI: exports · Package namespace supports the CLI entry path.