A command line tool to download Android applications directly from the GooglePlay Store.
PlaystoreDownloader is a tool for downloading Android applications directly fromthe Google Play Store. After an initial (one-time) configuration, applications can bedownloaded by specifying their package name.
This project is intended for learning purposes only and is not affiliated with Googlein any way.
Command Line Interface |
---|
Web Interface |
---|
There are two ways of getting a working copy of PlaystoreDownloader on your owncomputer: either by using Docker or byusing directly the source code in a Python 3
environment. In bothcases, the first thing to do is to get a local copy of this repository, so open up aterminal in the directory where you want to save the project and clone the repository:
$ git clone https://github.com/ClaudiuGeorgiu/PlaystoreDownloader.git
This is the suggested way of installing PlaystoreDownloader, since the only requirementis to have a recent version of Docker installed:
$ docker --version
Docker version 19.03.0, build aeac949
The official PlaystoreDownloader Docker imageis 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
If you downloaded the official image from Docker Hub, you are ready to use the tool sogo ahead and check the usage instructions, otherwise execute thefollowing command in the previously created PlaystoreDownloader/
directory (the foldercontaining 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 wasinstalled 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 instructionsfor more information.
Apart from valid Google Play Store credentials, the only requirement of this project isa working Python 3
(at least 3.6
) installation andpipenv
(for dependency management).
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.
$ # This project uses pipenv (https://pipenv.pypa.io/) for dependency management.
$ # It can be installed with the following command:
$ # python3 -m pip install pipenv
$ # Install PlaystoreDownloader's requirements (a virtual environment will be created).
$ pipenv install --deploy
After everything is installed, make a quick test to check that everything workscorrectly:
$ pipenv run python 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 instructionsfor more information.
Before interacting with the Google Play Store you have to provide valid credentialsand an ANDROID ID associated to your account. Please modify thecredentials.jsonfile and insert the required information before trying to use this tool:
Enter your Google email and password in the USERNAME
and PASSWORD
fields of thecredentials.jsonfile. This information is needed to authenticate with Google's servers. In case you have2-Step Verification activated, you will need to generate anApp Passwordfor the PASSWORD
field.
Use the above credentials on an Android device (real or emulated) and download atleast one application using the official Google Play Store on the device. This step isnecessary in order to associate the ANDROID ID of the device to your account, sothat you will be able to download applications as if you were directly using your device.Do not remove the account from the device or its ANDROID ID won't be valid anymore.
Get theANDROID IDof the device and fill the ANDROID_ID
field of thecredentials.jsonfile. You can obtain the ANDROID ID by installing theDevice IDapplication on your device, then copy the string corresponding toGoogle Service Framework (GSF)
(use this string instead of the Android Device ID
presented by the application).
In case of errors related to the authentication after the above steps, consider thefollowing actions (visit the links while you are logged in with the account used todownload the applications):
allow less secure apps to access your account (https://myaccount.google.com/lesssecureapps)
temporarily unlock access to your account (https://accounts.google.com/DisplayUnlockCaptcha)
Note that you will be able to download only the applications compatible with the devicecorresponding to the aforementioned ANDROID ID and further limitations may influencethe total number of applications available for download.
After configuring the Google Play Store credentials as described in theconfiguration, you should have a valid credentials.json
file readyto be used. The usage instructions depend on how you installed the tool.
The file with the credentials is not included in the Docker image, so it has to bemounted into the container. A download directory has to be mounted too, otherwise thedownloaded application won't be accessible to the host machine. If the currentdirectory (${PWD}
) contains the credentials.json
file and an output/
folder, thecommand 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 theavailable 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=python \
--rm -it downloader flask_app.py
$ # Navigate to http://localhost:5000/ to use the web interface.
In the main directory of the project (PlaystoreDownloader/
), call the followinginstruction using the package name of the app to be downloaded:
$ pipenv run python download.py "com.application.example"
If the download is successful, the resulting .apk
file will be saved in thePlaystoreDownloader/Downloads/
directory. You can change the name and the locationof the downloaded .apk
file by providing an additional -o "path/to/downloaded.apk"
argument todownload.py(type $ pipenv run python download.py --help
or check theavailable parameters for more information).
A simple web interface is also available:
$ pipenv run python flask_app.py
$ # Navigate to http://localhost:5000/ to use the web interface.
All the parameters are described in the help message:
$ # With Docker.
$ docker run --rm -it downloader --help
$ # With source.
$ pipenv run python 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:
-b
is a flag for downloading the additional .obb
files along with the application(if there are any). SeeExpansion Filesfor more information. The additional files will be saved in the same directory as thedownloaded application.
-s
is a flag for downloading the additional split .apk
files along with theapplication (if there are any). SeeDynamic Deliveryfor more information. The additional files will be saved in the same directory as thedownloaded application. Note: this feature used to work but currently seems broken.
-c CREDENTIALS
is used to set the path to the JSON configuration file containingthe Google Play Store credentials. If not specified, by default the tool will try touse a file named credentials.json
located in the directory where the command is run.
-o FILE
is used to set the path (relative or absolute) of the downloaded .apk
file (e.g., -o /home/user/Desktop/downloaded.apk
). If the path contains missingdirectories, they will be created automatically. If not specified, by default the filewill be saved in a Downloads/
directory created where the tool is run.
-t TAG
can be used to set a tag that will be prepended to the file name, e.g.,by using -t "LABEL"
the final name of the downloaded application will look like[LABEL] filename.apk
. Note: the tag is applied only to the main application, theadditional files won't have any tag added to the file name.
Note that currently only the command line interface is configurable with the abovearguments, the web interface will ask only for a package name and will use the defaultvalues for all the other parameters.
Questions, bug reports and pull requests are welcome on GitHub athttps://github.com/ClaudiuGeorgiu/PlaystoreDownloader(see contributing).
You are free to use this code under theMIT License.