PlaystoreDownloader

A command line tool to download Android applications directly from the Google Play Store.

Codacy Ubuntu Build Status Windows Build Status MacOS Build Status Code Coverage Python Version License

PlaystoreDownloader is a tool for downloading Android applications directly from the Google Play Store. After an initial (one-time) configuration, applications can be downloaded by specifying their package name.

This project is intended for learning purposes only and is not affiliated with Google in any way.

❱ Demo

Command Line Interface
CLI
Web Interface
Web

❱ Installation

There are two ways of getting a working copy of PlaystoreDownloader on your own computer: either by using Docker or by using directly the source code in a Python 3 environment. In both cases, the first thing to do is to get a local copy of this repository, so open up a terminal in the directory where you want to save the project and clone the repository:

$ git clone https://github.com/ClaudiuGeorgiu/PlaystoreDownloader.git

Docker image


Prerequisites

This is the suggested way of installing PlaystoreDownloader, since the only requirement is to have a recent version of Docker installed:

$ docker --version             
Docker version 19.03.0, build aeac949

Official Docker Hub image

The official PlaystoreDownloader Docker image is available on Docker Hub (automatically built from this repository):

$ # Download the Docker image.
$ docker pull claudiugeorgiu/playstore-downloader
$ # Give it a shorter name.
$ docker tag claudiugeorgiu/playstore-downloader downloader

Install

If you downloaded the official image from Docker Hub, you are ready to use the tool so go ahead and check the usage instructions, otherwise execute the following commands in the previously created PlaystoreDownloader/ directory (the folder containing the Dockerfile) in order to build the Docker image:

$ # Make sure to run the command in PlaystoreDownloader/ directory.
$ # It will take some time to download and install all the dependencies.
$ docker build -t downloader .

When the Docker image is ready, make a quick test to check that everything was installed correctly:

$ docker run --rm -it downloader --help
usage: download.py [-h] [-b] [-s] [-c CREDENTIALS] [-o FILE] [-t TAG] package
...

PlaystoreDownloader is now ready to be used, see the usage instructions for more information.

From source


Prerequisites

Apart from valid Google Play Store credentials, the only requirement of this project is a working Python 3 (at least 3.6) installation.

Install

Run the following commands in the main directory of the project (PlaystoreDownloader/) to install the needed dependencies:

$ # Make sure to run the commands in PlaystoreDownloader/ directory.

$ # The usage of a virtual environment is highly recommended, e.g., virtualenv.
$ # If not using virtualenv (https://virtualenv.pypa.io/), skip the next 2 lines.
$ virtualenv -p python3 venv
$ source venv/bin/activate

$ # Install PlaystoreDownloader's requirements.
$ python3 -m pip install -r requirements.txt

After the requirements are installed, make a quick test to check that everything works correctly:

$ python3 download.py --help
usage: download.py [-h] [-b] [-s] [-c CREDENTIALS] [-o FILE] [-t TAG] package
...

PlaystoreDownloader is now ready to be used, see the usage instructions for more information.

❱ Configuration

Before interacting with the Google Play Store you have to provide valid credentials and an ANDROID ID associated to your account. Please modify the credentials.json file and insert the required information before trying to use this tool:

Note that you will be able to download only the applications compatible with the device corresponding to the aforementioned ANDROID ID and further limitations may influence the total number of applications available for download.

❱ Usage

After configuring the Google Play Store credentials as described in the configuration, you should have a valid credentials.json file ready to be used. The usage instructions depend on how you installed the tool.

With Docker

The file with the credentials is not included in the Docker image, so it has to be mounted into the container. A download directory has to be mounted too, otherwise the downloaded application won't be accessible to the host machine. If the current directory (${PWD}) contains the credentials.json file and an output/ folder, the command to download an application with package name com.application.example becomes:

$ docker run \
    -u $(id -u):$(id -g) \
    -v "${PWD}/credentials.json":"/app/credentials.json" \
    -v "${PWD}/output/":"/app/Downloads/" \
    --rm -it downloader "com.application.example"

If the download is successful, the resulting .apk file will be saved in the output/ folder contained in the directory where the command was run (type $ docker run --rm -it downloader --help or check the available parameters for more information).

A simple web interface is also available:

$ docker run \
    -u $(id -u):$(id -g) \
    -v "${PWD}/credentials.json":"/app/credentials.json" \
    -v "${PWD}/output/":"/app/Downloads/" \
    -p 5000:5000 \
    --entrypoint=python3 \
    --rm -it downloader flask_app.py

$ # Navigate to http://localhost:5000/ to use the web interface.

With source

In the main directory of the project (PlaystoreDownloader/), call the following instruction using the package name of the app to be downloaded:

$ python3 download.py "com.application.example"

If the download is successful, the resulting .apk file will be saved in the PlaystoreDownloader/Downloads/ directory. You can change the name and the location of the downloaded .apk file by providing an additional -o "path/to/downloaded.apk" argument to download.py (type $ python3 download.py --help or check the available parameters for more information).

A simple web interface is also available:

$ python3 flask_app.py

$ # Navigate to http://localhost:5000/ to use the web interface.

Available parameters

All the parameters are described in the help message:

$ # With Docker.
$ docker run --rm -it downloader --help

$ # With source.
$ python3 download.py --help

usage: download.py [-h] [-b] [-s] [-c CREDENTIALS] [-o FILE] [-t TAG] package
...

The only mandatory parameter is the package name of the application to be downloaded, as it appears in the Google Play Store (e.g., com.spotify.music or com.whatsapp). The other optional arguments are as follows:

Note that currently only the command line interface is configurable with the above arguments, the web interface will ask only for a package name and will use the default values for all the other parameters.

❱ Contributing

Questions, bug reports and pull requests are welcome on GitHub at https://github.com/ClaudiuGeorgiu/PlaystoreDownloader.

❱ License

You are free to use this code under the MIT License.