Last active
August 29, 2024 01:02
-
-
Save arulrajnet/d50d0e81eaa354297347 to your computer and use it in GitHub Desktop.
Script to download apk file from Google Play a.k.a Android Market.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Script to download apk file from Google Play a.k.a Android Market. | |
# Accepts package name or Google Play URL as input. | |
# Files are download from apk-dl.com | |
# author : Arul (@arulrajnet) | |
# | |
APK_DL_URL="http://apk-dl.com/store/apps/details?id=%s" | |
PACKAGE_NAME="" | |
# Parse the user given input | |
function parse() { | |
# TODO for parse package and google play url | |
package_re="/^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$/i" | |
if [[ $1 =~ $package_re ]]; then | |
echo ${BASH_REMATCH[1]} | |
fi | |
url_re="*play.google.com/store/apps/details?id=*" | |
PACKAGE_NAME=$1 | |
} | |
# Download the apk file | |
function download() { | |
echo -e "Downloading..." | |
local ua="Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36" | |
local url=`printf ${APK_DL_URL} ${PACKAGE_NAME}` | |
curl "$url" -o "$PACKAGE_NAME.apk" --write-out "%{http_code}" --compressed --retry 10 --retry-max-time 0 \ | |
-H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" \ | |
-H "Connection: keep-alive" -H "Accept-Encoding: gzip,deflate,sdch" \ | |
-H "Accept-Language: en-US,en;q=0.8,ta;q=0.6" \ | |
-H "User-Agent: $ua" | |
} | |
# Validate basic requirement for this script | |
function validate() { | |
# Commands used in this script | |
local CMDS="curl" | |
for i in ${CMDS} | |
do | |
type -P ${i} &>/dev/null && continue || { echo "$i command not found."; exit 1; } | |
done | |
} | |
function usage() { | |
echo -e "Usage: \n\t$0 com.whatsapp \n\t$0 https://play.google.com/store/apps/details?id=com.whatsapp" | |
exit 1 | |
} | |
# How its called | |
if test -z "$1" | |
then | |
usage | |
fi | |
validate | |
parse $1 | |
download ${PACKAGE_NAME} | |
exit 0 |
Dear sir,
can you please reshape this script as a Greasemonkey script (for Firefox)?
More info here
https://greasyfork.org/en
Dear Sir,
Could you please give me some advice to use this code please.
I need to adapt with my senior project.
would be my pleasure that you could help me.
I stuck for a long time.
Thank a alot
I,m sorry but the script doesn't download the apk. Only creates html file with apk extension. Can you help me to solve this please?
hi,
i need a script for making Repository site for android apps(apk). the script i am looking for is to use getting fresh data from Playstore and save into my cloud and then automaticly publish on my site.
can you help me for this script
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi
Its giving me error
( ! ) Parse error: syntax error, unexpected '=' in /var/www/default/public_html/sanjay/index.php on line 10
I need php script to download a file from google play store.